CN112306637A - Script extension method and device, computer equipment and storage medium - Google Patents
Script extension method and device, computer equipment and storage medium Download PDFInfo
- Publication number
- CN112306637A CN112306637A CN202011227806.6A CN202011227806A CN112306637A CN 112306637 A CN112306637 A CN 112306637A CN 202011227806 A CN202011227806 A CN 202011227806A CN 112306637 A CN112306637 A CN 112306637A
- Authority
- CN
- China
- Prior art keywords
- script
- task
- executing
- engine
- task execution
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000013515 script Methods 0.000 title claims abstract description 314
- 238000000034 method Methods 0.000 title claims abstract description 54
- 238000004590 computer program Methods 0.000 claims description 25
- 230000006870 function Effects 0.000 claims description 18
- 230000008569 process Effects 0.000 claims description 12
- 230000007958 sleep Effects 0.000 description 14
- 238000004891 communication Methods 0.000 description 8
- 238000010586 diagram Methods 0.000 description 5
- 238000007796 conventional method Methods 0.000 description 3
- 238000005265 energy consumption Methods 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 230000006266 hibernation Effects 0.000 description 3
- 230000003993 interaction Effects 0.000 description 3
- 241000282326 Felis catus Species 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000018109 developmental process Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45504—Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/4401—Bootstrapping
- G06F9/4418—Suspend and resume; Hibernate and awake
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44521—Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45504—Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
- G06F9/45508—Runtime interpretation or emulation, e g. emulator loops, bytecode interpretation
- G06F9/45512—Command shells
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Security & Cryptography (AREA)
- Stored Programmes (AREA)
- Devices For Executing Special Programs (AREA)
Abstract
The application relates to a script extension method, a script extension device, computer equipment and a storage medium. The method comprises the following steps: loading an extended script; the extension script is a pre-written script for realizing a customized function; interpreting the extended script into a task execution command which can be identified by a task execution engine through a script interpreter; sending the task execution command to the task execution engine through a virtual channel; executing the task execution command through the task execution engine, generating an execution result and returning the execution result to the virtual channel; and returning the execution result to a rule engine through the virtual channel so as to interact with the outside. By adopting the method, the hardware cost can be saved.
Description
Technical Field
The present application relates to the field of computer technologies, and in particular, to a script extension method and apparatus, a computer device, and a storage medium.
Background
With the development of computer technology, related functions are generally required to be customized for a communication device by related technical personnel in order to realize the interaction between the communication device and an external device. The conventional method for customizing the related functions for the communication device is implemented by adding codes corresponding to the customized related functions to an open computer system or by adding a micro control unit.
The traditional method of adding code corresponding to customized related functions in an open computer system has high requirements for memory and flash memory. By adding a micro control unit, which is a conventional method, an additional purchase of the micro control unit is required. Therefore, the conventional methods require high hardware costs.
Disclosure of Invention
In view of the above, it is necessary to provide a script extension method, apparatus, computer device and storage medium capable of saving hardware cost in view of the above technical problems.
A script extension method, the method comprising:
loading an extended script; the extension script is a pre-written script for realizing a customized function;
interpreting the extended script into a task execution command which can be identified by a task execution engine through a script interpreter;
sending the task execution command to the task execution engine through a virtual channel;
executing the task execution command through the task execution engine, generating an execution result and returning the execution result to the virtual channel;
and returning the execution result to a rule engine through the virtual channel so as to interact with the outside.
In one embodiment, the method further comprises:
executing the startup script through the rule engine;
after the startup script is executed, detecting whether an extended script to be executed exists or not through the rule engine;
and when the extended script to be executed exists, executing the step of loading the extended script and the subsequent steps until the execution result is returned to a rule engine through the virtual channel so as to realize the execution of the extended script.
In one embodiment, the method further comprises:
if the number of the extended scripts to be executed is multiple, then
And after the current extended script is executed and a preset time interval is reached, taking the next extended script as the current extended script, and returning to the step of loading the extended script and the subsequent steps so as to execute the next extended script.
In one embodiment, the method further comprises:
and when detecting that the extended script to be executed does not exist, executing a dormant script through the rule engine to enter a dormant state.
In one embodiment, the method further comprises:
after entering a dormant state, continuously detecting whether an extended script to be executed exists through the rule engine; when the existence of the extended script to be executed is detected, then
And executing the awakening script, and returning to the step of loading the extension script after awakening.
In one embodiment, after the sending the execute task command to the execute task engine through the virtual channel, the method further includes:
if the field of the task execution command is the field which can be identified by the task execution engine, executing the step of executing the task execution command by the task execution engine;
and when the field of the task execution command contains a field which cannot be identified by the task execution engine, informing a script interpreter to re-analyze the extended script through the virtual channel.
In one embodiment, the number of the task execution commands obtained by interpreting the extended script is multiple;
the executing the task executing command by the task executing engine and generating an execution result comprises:
in the process of executing a plurality of task execution commands through the task execution engine, redirecting the output of a previous target task execution command into the input of a next task execution command until a plurality of task execution commands are executed, and generating an execution result;
the prior target execution task command is an execution task command which is executed in advance and needs to make output as redirection input.
A script extension apparatus, the apparatus comprising:
the loading module is used for loading the extended script; the extension script is a pre-written script for realizing a customized function;
the interpretation module is used for interpreting the extended script into a task execution command which can be identified by the task execution engine through the script interpreter;
the sending module is used for sending the task execution command to the task execution engine through a virtual channel;
the generating module is used for executing the task executing command through the task executing engine, generating an executing result and returning the executing result to the virtual channel;
and the return module is used for returning the execution result to the rule engine through the virtual channel so as to interact with the outside.
A computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:
loading an extended script; the extension script is a pre-written script for realizing a customized function;
interpreting the extended script into a task execution command which can be identified by a task execution engine through a script interpreter;
sending the task execution command to the task execution engine through a virtual channel;
executing the task execution command through the task execution engine, generating an execution result and returning the execution result to the virtual channel;
and returning the execution result to a rule engine through the virtual channel so as to interact with the outside.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
loading an extended script; the extension script is a pre-written script for realizing a customized function;
interpreting the extended script into a task execution command which can be identified by a task execution engine through a script interpreter;
sending the task execution command to the task execution engine through a virtual channel;
executing the task execution command through the task execution engine, generating an execution result and returning the execution result to the virtual channel;
and returning the execution result to a rule engine through the virtual channel so as to interact with the outside.
The script extension method, the script extension device, the computer equipment and the storage medium are used for loading the extension script, interpreting the extension script into a task execution command which can be identified by the task execution engine through the script interpreter, and sending the task execution command to the task execution engine through the virtual channel to complete execution. The execution of the task execution command can be completed and the execution result can be generated through the task execution engine without additional hardware cost. And finally, returning the generated execution result to a rule engine through the virtual channel to interact with the outside. The generated execution result can be transmitted to the outside for interaction without additionally increasing a hardware unit for controlling the terminal to interact with the outside. In the whole process, no extra cost expense of hardware is involved, so that the script extension method can save the cost of the hardware.
Drawings
FIG. 1 is a flowchart illustrating a script extension method according to one embodiment;
FIG. 2 is a flowchart illustrating the script expansion step in one embodiment;
FIG. 3 is a flowchart illustrating the script expansion step in one embodiment;
FIG. 4 is a block diagram showing the construction of a script extension apparatus according to one embodiment;
FIG. 5 is a block diagram showing the configuration of a script extension apparatus in one embodiment;
FIG. 6 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
In one embodiment, as shown in fig. 1, a script extension method is provided, and this embodiment is illustrated by applying the method to a terminal, and it is understood that the terminal may be a mobile terminal, a computer, or a special-purpose device. Among them, the mobile terminal is, for example, a mobile phone, a tablet computer, a handheld POS (point of sale) machine. Computers such as desktop computers, notebook computers, and the like. A special device with Modem function, such as a Modem (english name Modem), commonly called "cat", etc. The script extension method specifically comprises the following steps:
step 102, loading an extended script; an extended script is a pre-written script that is used to implement a customized function.
Specifically, the user writes the extension script in advance according to the customized function that needs to be implemented. And the terminal loads the extended script.
In one embodiment, the user pre-writes extension scripts and uploads them to a pre-set server according to the customized functionality that the user needs to implement. The terminal may download the extended script at a preset server.
And step 104, interpreting the extended script into a task execution command which can be identified by the task execution engine through the script interpreter.
The script interpreter is an interpreter for translating the extended script into a task execution command which can be recognized by the task execution engine. The executive task engine is an engine for executing task commands. The execution task command has the same function as the extended script and can be executed only by the execution task engine.
Specifically, the terminal interprets the loaded extended script through the script interpreter to interpret the extended script into a task execution command recognizable by the task execution engine.
In one embodiment, the execute task command may be an "at (attention)" command.
In one embodiment, the executive task engine may be an "AT" engine.
It is understood that the interpreted task execution command for an extended script may be one or more. A plurality is at least two.
It can be understood that the extended script is directly interpreted into the execution task command which can be recognized by the execution task engine, and because the functional flow for executing the task command is known, if a problem occurs in the process of executing the task command, the execution task command with the problem can be directly and quickly positioned according to the functional flow, so that the execution task command with the problem can be quickly corrected, and the efficiency of generating an execution result is improved.
And step 106, sending the task execution command to the task execution engine through the virtual channel.
The virtual channel is a logic channel for realizing input and output of the executive task engine.
It can be understood that the script interpreter on the terminal inputs the interpreted task execution command to the task execution engine through the virtual channel, and the task execution engine can output the execution result to the rule engine through the virtual channel. Thus, the input and output of the executive task engine is implemented by the virtual channel.
The execution result is a result generated after the executive task engine executes the executive task command. The rule engine is an engine that executes a corresponding script according to a preset rule. The rule engine is used for supporting the execution of a task execution command, and can also be used for supporting a user to define a simple data processing flow due to the functions of condition judgment, character comparison and the like supported by the self-contained script language.
And step 108, executing the task execution command through the task execution engine, generating an execution result and returning the execution result to the virtual channel.
Specifically, the executive task engine on the terminal receives an executive task command sent by the script interpreter through the virtual channel. The executive task engine can execute the executive task command and generate an execution result. Further, the executive task engine on the terminal returns the generated execution result to the virtual channel.
It can be understood that, when there are a plurality of executed task commands interpreted by one extended script, the executed task engine may generate a final executed result after all the executed task commands are executed.
And step 110, returning the execution result to the rule engine through the virtual channel so as to interact with the outside.
Specifically, the rule engine on the terminal receives the execution result through the virtual channel. Further, the rule engine on the terminal sends the execution result to the outside to interact with the outside.
The script extension method, the script extension device, the computer equipment and the storage medium are used for loading the extension script, interpreting the extension script into a task execution command which can be identified by the task execution engine through the script interpreter, and sending the task execution command to the task execution engine through the virtual channel to complete execution. The execution of the task execution command can be completed and the execution result can be generated through the task execution engine without additional hardware cost. And finally, returning the generated execution result to the rule engine through the virtual channel so as to interact with the outside. The generated execution result can be transmitted to the outside for interaction without additionally increasing a hardware unit for controlling the terminal to interact with the outside. In the whole process, no extra cost expense of hardware is involved, so that the script extension method can save the cost of the hardware.
In one embodiment, the method further comprises: executing the startup script through the rule engine; after the startup script is executed, detecting whether an extended script to be executed exists through a rule engine; and when detecting that the extended script to be executed exists, executing the step of loading the extended script and the subsequent steps until an execution result is returned to the rule engine through the virtual channel so as to realize the execution of the extended script.
The startup script is a script which can be executed to start up the terminal.
Specifically, a rules engine on the terminal executes the boot script. And after executing the startup script, the rule engine on the terminal further detects whether an extended script to be executed exists. When the rule engine on the terminal detects that there is an extended script to be executed, the extended script can be executed. It can be understood that the steps 102 to 110 are specific steps for executing each extended script, and therefore, the step of loading the extended script and the subsequent steps can be executed until the execution result is returned to the rule engine through the virtual channel, so as to implement the execution of the extended script.
In one embodiment, the boot script is executed only when the terminal is powered on to complete configuration of the initial state of the external device on the terminal. For example, the rule engine on the terminal executes the startup script to complete the setting of the high and low levels of the GPIO and the initialization of the plug-in device when the terminal is powered on, and may also complete the setting of the configuration items, such as setting a preset time interval corresponding to the timing task.
In one embodiment, when the existence of the extended script to be executed is detected, the extended script can be executed regularly. It is understood that there may be one or more extended scripts to be executed, and when there are multiple extended scripts to be executed, each extended script may be executed in sequence at regular time.
In the embodiment, whether the extended script to be executed exists or not is detected by the rule engine on the terminal, and the step of loading the extended script and the subsequent steps are executed after the extended script to be executed exists, so that the useless steps executed by the terminal when the extended script to be executed does not exist can be avoided, and the energy consumption of the terminal is saved.
In one embodiment, the method further comprises: and if the number of the extended scripts to be executed is multiple, after the current extended script is executed and a preset time interval is reached, taking the next extended script as the current extended script, and returning to the step of executing the loaded extended script and the subsequent steps so as to execute the next extended script.
Specifically, if there are a plurality of extension scripts to be executed, the rule engine on the terminal takes the next extension script as the current extension script after the current extension script is executed and when a preset time interval is reached, and returns to the step of executing the extension script and the subsequent steps to execute the next extension script. Namely, the steps 102 to 110 can be executed for each extended script to implement the execution of the extended script, and after one extended script is executed, the next extended script is executed in a timed manner, that is, the steps 102 to 110 are continuously executed for the next extended script to implement the execution of the next extended script.
In this embodiment, after the current extension script is executed and a preset time interval is reached, the rule engine on the terminal takes the next extension script as the current extension script, and returns to the step of executing the loading extension script and the subsequent steps to execute the next extension script. Therefore, the rule engine on the terminal can orderly execute all the extension scripts to be executed in order, and the execution of the extension scripts to be executed is not influenced mutually.
In one embodiment, the method further comprises: and when detecting that the extended script to be executed does not exist, executing the dormant script through the rule engine to enter a dormant state.
The sleep script is a script for making the terminal enter a sleep state after being executed.
Specifically, when the rule engine on the terminal detects that no extension script to be executed exists, the sleep script is executed. And after the rule engine on the terminal executes the sleep script, the terminal enters a sleep state.
In this embodiment, when the rule engine on the terminal detects that there is no extension script to be executed, the terminal enters a sleep state by executing the sleep script, so that energy consumption of the terminal can be saved.
In one embodiment, the method further comprises: after entering a dormant state, continuously detecting whether an extended script to be executed exists through a rule engine; and when detecting that the extended script to be executed exists, executing the awakening script, and returning to the step of executing the loading extended script after awakening.
The wake-up script is a state that can restore the terminal in the dormant state to the state before entering the dormant state after being executed.
Specifically, after the terminal enters the sleep state, the rule engine continues to detect whether the extended script to be executed exists. And when the rule engine on the terminal detects that the extended script to be executed exists, executing the wake-up script. And after the rule engine on the terminal wakes up the terminal, returning to the step of loading the extended script and the subsequent steps.
In this embodiment, when the rule engine on the terminal detects that there is an extended script to be executed, the wakeup script is executed, so that the terminal can be quickly restored from a sleep state that saves energy consumption to a state before sleep, so as to execute the step of loading the extended script and subsequent steps.
In one embodiment, after sending the execute task command to the execute task engine via the virtual channel, the method further comprises: if the field for executing the task command is the field which can be identified by the task execution engine, executing the step of executing the task execution command by the task execution engine; and when the field of the task execution command contains a field which cannot be identified by the task execution engine, informing the script interpreter of re-analyzing the extended script through the virtual channel.
Specifically, if the fields for executing the task command are all identifiable fields, the task execution engine on the terminal executes the task execution command, generates an execution result and returns the execution result to the virtual channel; and returning the execution result to the rule engine through the virtual channel so as to interact with the outside. And if the field for executing the task command has the field which can not be identified, the task executing engine on the terminal informs the script interpreter to re-analyze the extended script through the virtual channel.
In one embodiment, after receiving the notification, the script interpreter may re-interpret only the execute task command having unrecognized fields, or may re-parse the entire loaded extended script.
In this embodiment, if there is a task execution command of an unrecognizable field, the virtual channel notifies the script interpreter to re-analyze the extended script, so that the task execution engine can be ensured to smoothly complete execution of the task execution command.
In one embodiment, the number of the task execution commands obtained by interpreting the extended script is multiple; executing the execute task command by the execute task engine, and generating an execution result comprises: in the process of executing a plurality of task execution commands through the task execution engine, redirecting the output of a previous target task execution command into the input of a next task execution command until a plurality of task execution commands are executed, and generating an execution result; the prior target execution task command is an execution task command which is executed in advance and needs to make output as redirection input.
Wherein, the redirection (Redirect) is to relocate the execution result of the previously executed task command as the input of the subsequently executed task command.
It is understood that, for example, the next task execution command is to add two factors, and the first output result and the second output result generated after the previous target task execution command is executed can be redirected to the first input factor and the second input factor of the next task execution command by redirection, so as to execute the next task execution command, that is, to complete the addition of the two factors.
Specifically, in the process of executing a plurality of task execution commands through the task execution engine, the task execution engine on the terminal takes the output of the previous target task execution command as the input of the next task execution command corresponding to redirection until the plurality of task execution commands are executed, and generates an execution result.
In this embodiment, by redirecting the output of the previous target execution task command to the input of the next execution task command, the execution task engine can complete the execution of the execution task command according to the specified direction to generate the execution result.
In one embodiment, the terminal loads the extended script, as illustrated in the flowchart of the script extension step of FIG. 2. And the script interpreter on the terminal interprets the extended script into a task execution command which can be identified by the task execution engine through the virtual channel and sends the task execution command to the task execution engine. And if the field for executing the task command has the field which can not be identified, the task executing engine on the terminal informs the script interpreter to re-analyze the extended script through the virtual channel. And if the fields for executing the task command are all identifiable fields, executing the task executing command by a task executing engine on the terminal. And the execution of the execution task engine on the terminal returns the execution result generated according to the execution task command to the rule engine through the virtual channel. And the rule engine on the terminal sends the execution result to the outside so as to interact with the outside.
In one embodiment, the terminal is powered on (i.e., "module powered on") and the rule engine executes the boot script, as shown in the flowchart of the script extension step of fig. 3. And after executing the startup script, the rule engine on the terminal further detects whether an extended script to be executed exists. If a plurality of extension scripts are to be executed, the rule engine on the terminal takes the next extension script as the current extension script after the current extension script is executed and when a preset time interval is reached, and returns to the step of executing the loading extension script and the subsequent steps so as to execute the next extension script. And when the rule engine on the terminal detects that the extension script to be executed does not exist, executing the sleep script. And after the rule engine on the terminal executes the sleep script, the terminal enters a sleep state. And after the terminal enters a dormant state, continuously detecting whether the extended script to be executed exists through the rule engine. And when the rule engine on the terminal detects that the extended script to be executed exists, executing the wake-up script. And after the rule engine on the terminal wakes up the terminal, returning to the step of executing the loading of the extended script. And when the rule engine on the terminal does not detect the existence of the extended script to be executed after exceeding the time length threshold value, interrupting the awakening.
It should be understood that, although the steps in the flowcharts of fig. 1 to 3 are shown in sequence as indicated by the arrows, the steps are not necessarily performed in sequence as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 1 to 3 may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of performing the steps or stages is not necessarily sequential, but may be performed alternately or alternately with other steps or at least some of the other steps or stages.
In one embodiment, as shown in FIG. 4, there is provided a script extension apparatus 400 comprising: a load module 404, an interpret module 406, a send module 408, an execute module 410, and a return module 412, wherein:
a loading module 404, configured to load an extended script; an extended script is a pre-written script that is used to implement a customized function.
And an interpreting module 406 for interpreting the extended script into a task execution command recognizable by the task execution engine through the script interpreter.
A sending module 408, configured to send the execute task command to the execute task engine through the virtual channel.
The execution module 410 is configured to execute the execute task command through the execute task engine, generate an execution result, and return the execution result to the virtual channel.
And a returning module 412, configured to return the execution result to the rule engine through the virtual channel to interact with the outside.
In one embodiment, the boot module 401 is configured to execute a boot script via a rule engine; after the startup script is executed, detecting whether an extended script to be executed exists through a rule engine; and when detecting that the extended script to be executed exists, executing the step of loading the extended script and the subsequent steps until an execution result is returned to the rule engine through the virtual channel so as to realize the execution of the extended script.
In an embodiment, the timing module 402 is configured to, if there are multiple extended scripts to be executed, after the current extended script is executed and a preset time interval is reached, take the next extended script as the current extended script, and return to the step of executing the extension script and the subsequent steps to execute the next extended script.
In one embodiment, the hibernation module 414 is configured to execute the hibernation script by the rule engine to enter the hibernation state when it is detected that there is no extension script to be executed.
As shown in fig. 5, in one embodiment, the apparatus further comprises: a starting-up module 401, a timing module 402, a sleeping module 414 and a waking-up module 416;
a wake-up module 416, configured to continue to detect whether there is an extended script to be executed through the rule engine after entering the sleep state; and when detecting that the extended script to be executed exists, executing the awakening script, and returning to the step of executing the loading extended script after awakening.
In one embodiment, the executing module 410 is further configured to execute the step of executing the task execution command by the task execution engine if the field of the task execution command is a field that can be recognized by the task execution engine; and when the field of the task execution command contains a field which cannot be identified by the task execution engine, informing the script interpreter of re-analyzing the extended script through the virtual channel.
In one embodiment, the executing module 410 is further configured to redirect, during the process of executing a plurality of task executing commands by the task executing engine, an output of a previous target task executing command to an input of a next task executing command until the plurality of task executing commands are executed, and generate an execution result; the prior target execution task command is an execution task command which is executed in advance and needs to make output as redirection input.
For specific limitations of the script extension apparatus, reference may be made to the above limitations of the script extension method, which are not described herein again. The modules in the script extension apparatus can be wholly or partially implemented by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as shown in fig. 6. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless communication can be realized through WIFI, an operator network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a script extension method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.
Those skilled in the art will appreciate that the architecture shown in fig. 6 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program:
loading an extended script; the extension script is a pre-written script for realizing a customized function;
the extended script is interpreted into a task execution command which can be identified by a task execution engine through a script interpreter;
sending the task execution command to a task execution engine through a virtual channel;
executing the task execution command through the task execution engine, generating an execution result and returning the execution result to the virtual channel;
and returning the execution result to the rule engine through the virtual channel so as to interact with the outside.
In one embodiment, the processor, when executing the computer program, further performs the steps of: executing the startup script through the rule engine; after the startup script is executed, detecting whether an extended script to be executed exists through a rule engine; and when detecting that the extended script to be executed exists, executing the step of loading the extended script and the subsequent steps until an execution result is returned to the rule engine through the virtual channel so as to realize the execution of the extended script.
In one embodiment, the processor, when executing the computer program, further performs the steps of: and if the number of the extended scripts to be executed is multiple, after the current extended script is executed and a preset time interval is reached, taking the next extended script as the current extended script, and returning to the step of executing the loaded extended script and the subsequent steps so as to execute the next extended script.
In one embodiment, the processor, when executing the computer program, further performs the steps of: and when detecting that the extended script to be executed does not exist, executing the dormant script through the rule engine to enter a dormant state.
In one embodiment, the processor, when executing the computer program, further performs the steps of: after entering a dormant state, continuously detecting whether an extended script to be executed exists through a rule engine; and when detecting that the extended script to be executed exists, executing the awakening script, and returning to the step of executing the loading extended script after awakening. In one embodiment, the processor, when executing the computer program, further performs the steps of: if the field for executing the task command is the field which can be identified by the task execution engine, executing the step of executing the task execution command by the task execution engine; and when the field of the task execution command contains a field which cannot be identified by the task execution engine, informing the script interpreter of re-analyzing the extended script through the virtual channel.
In one embodiment, the processor, when executing the computer program, further performs the steps of: in the process of executing a plurality of task execution commands through the task execution engine, redirecting the output of a previous target task execution command into the input of a next task execution command until a plurality of task execution commands are executed, and generating an execution result; the prior target execution task command is an execution task command which is executed in advance and needs to make output as redirection input.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
loading an extended script; the extension script is a pre-written script for realizing a customized function;
the extended script is interpreted into a task execution command which can be identified by a task execution engine through a script interpreter;
sending the task execution command to a task execution engine through a virtual channel;
executing the task execution command through the task execution engine, generating an execution result and returning the execution result to the virtual channel;
and returning the execution result to the rule engine through the virtual channel so as to interact with the outside.
In one embodiment, the computer program when executed by the processor further performs the steps of: executing the startup script through the rule engine; after the startup script is executed, detecting whether an extended script to be executed exists through a rule engine; and when detecting that the extended script to be executed exists, executing the step of loading the extended script and the subsequent steps until an execution result is returned to the rule engine through the virtual channel so as to realize the execution of the extended script.
In one embodiment, the computer program when executed by the processor further performs the steps of: and if the number of the extended scripts to be executed is multiple, after the current extended script is executed and a preset time interval is reached, taking the next extended script as the current extended script, and returning to the step of executing the loaded extended script and the subsequent steps so as to execute the next extended script.
In one embodiment, the computer program when executed by the processor further performs the steps of: and when detecting that the extended script to be executed does not exist, executing the dormant script through the rule engine to enter a dormant state.
In one embodiment, the computer program when executed by the processor further performs the steps of: after entering a dormant state, continuously detecting whether an extended script to be executed exists through a rule engine; and when detecting that the extended script to be executed exists, executing the awakening script, and returning to the step of executing the loading extended script after awakening.
In one embodiment, the computer program when executed by the processor further performs the steps of: if the field for executing the task command is the field which can be identified by the task execution engine, executing the step of executing the task execution command by the task execution engine; and when the field of the task execution command contains a field which cannot be identified by the task execution engine, informing the script interpreter of re-analyzing the extended script through the virtual channel.
In one embodiment, the computer program when executed by the processor further performs the steps of: in the process of executing a plurality of task execution commands through the task execution engine, redirecting the output of a previous target task execution command into the input of a next task execution command until a plurality of task execution commands are executed, and generating an execution result; the prior target execution task command is an execution task command which is executed in advance and needs to make output as redirection input.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database or other medium used in the embodiments provided herein can include at least one of non-volatile and volatile memory. Non-volatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical storage, or the like. Volatile Memory can include Random Access Memory (RAM) or external cache Memory. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.
Claims (10)
1. A script extension method, comprising:
loading an extended script; the extension script is a pre-written script for realizing a customized function;
interpreting the extended script into a task execution command which can be identified by a task execution engine through a script interpreter;
sending the task execution command to the task execution engine through a virtual channel;
executing the task execution command through the task execution engine, generating an execution result and returning the execution result to the virtual channel;
and returning the execution result to a rule engine through the virtual channel so as to interact with the outside.
2. The method of claim 1, further comprising:
executing the startup script through the rule engine;
after the startup script is executed, detecting whether an extended script to be executed exists or not through the rule engine;
and when the extended script to be executed exists, executing the step of loading the extended script and the subsequent steps until the execution result is returned to a rule engine through the virtual channel so as to realize the execution of the extended script.
3. The method of claim 2, further comprising:
if the number of the extended scripts to be executed is multiple, then
And after the current extended script is executed and a preset time interval is reached, taking the next extended script as the current extended script, and returning to the step of loading the extended script and the subsequent steps so as to execute the next extended script.
4. The method of claim 2, further comprising:
and when detecting that the extended script to be executed does not exist, executing a dormant script through the rule engine to enter a dormant state.
5. The method of claim 4, further comprising:
after entering a dormant state, continuously detecting whether an extended script to be executed exists through the rule engine;
when the existence of the extended script to be executed is detected, then
And executing the awakening script, and returning to the step of loading the extension script after awakening.
6. The method of claim 1, wherein after sending the execute task command to the execute task engine via a virtual channel, the method further comprises:
if the field of the task execution command is the field which can be identified by the task execution engine, executing the step of executing the task execution command by the task execution engine;
and when the field of the task execution command contains a field which cannot be identified by the task execution engine, informing a script interpreter to re-analyze the extended script through the virtual channel.
7. The method according to any one of claims 1 to 6, wherein the number of the task execution commands interpreted for one extended script is plural;
the executing the task executing command by the task executing engine and generating an execution result comprises:
in the process of executing a plurality of task execution commands through the task execution engine, redirecting the output of a previous target task execution command into the input of a next task execution command until a plurality of task execution commands are executed, and generating an execution result;
the prior target execution task command is an execution task command which is executed in advance and needs to make output as redirection input.
8. A script extension apparatus, characterized in that the apparatus comprises:
the loading module is used for loading the extended script; the extension script is a pre-written script for realizing a customized function;
the interpretation module is used for interpreting the extended script into a task execution command which can be identified by the task execution engine through the script interpreter;
the sending module is used for sending the task execution command to the task execution engine through a virtual channel;
the generating module is used for executing the task executing command through the task executing engine, generating an executing result and returning the executing result to the virtual channel;
and the return module is used for returning the execution result to the rule engine through the virtual channel so as to interact with the outside.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method of any of claims 1 to 7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011227806.6A CN112306637B (en) | 2020-11-06 | 2020-11-06 | Script expansion method, script expansion device, computer equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011227806.6A CN112306637B (en) | 2020-11-06 | 2020-11-06 | Script expansion method, script expansion device, computer equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112306637A true CN112306637A (en) | 2021-02-02 |
CN112306637B CN112306637B (en) | 2024-06-21 |
Family
ID=74326207
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011227806.6A Active CN112306637B (en) | 2020-11-06 | 2020-11-06 | Script expansion method, script expansion device, computer equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112306637B (en) |
Citations (24)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7024363B1 (en) * | 1999-12-14 | 2006-04-04 | International Business Machines Corporation | Methods and apparatus for contingent transfer and execution of spoken language interfaces |
KR20060034824A (en) * | 2004-10-20 | 2006-04-26 | 주식회사 엠투미 | Method and system for providing macro service of mobile terminal using script embedded image file |
EP1715413A1 (en) * | 2005-04-18 | 2006-10-25 | Research In Motion Limited | Method and system for extending scripting languages |
CN101021863A (en) * | 2006-02-13 | 2007-08-22 | 国际商业机器公司 | Method and system for annotating an audio file with an audio hyperlink |
CN101119522A (en) * | 2007-08-22 | 2008-02-06 | 中兴通讯股份有限公司 | Method for simulating AT command report |
CN101138228A (en) * | 2005-01-06 | 2008-03-05 | 奥林奇股份有限公司 | Customisation of voicexml application |
CN101634940A (en) * | 2008-07-25 | 2010-01-27 | 苏州市蜗牛电子有限公司 | Method for developing computer games through scripts |
CN101667134A (en) * | 2009-09-23 | 2010-03-10 | 中兴通讯股份有限公司 | Method for constructing compiling system, compiling system and constructing device thereof |
CN102255674A (en) * | 2010-05-19 | 2011-11-23 | 希姆通信息技术(上海)有限公司 | LUA-script-based wireless module automatic testing method |
US20130080874A1 (en) * | 2011-09-23 | 2013-03-28 | Oracle International Corporation | Dynamic display of web page content based on a rules system |
CN103746873A (en) * | 2013-12-30 | 2014-04-23 | 深圳市广和通实业发展有限公司 | System and method for testing communication module |
CN103838711A (en) * | 2012-11-26 | 2014-06-04 | 上海柚艾信息技术有限公司 | Definable typed semantic parsing system and method based on rules |
CN103927174A (en) * | 2014-04-17 | 2014-07-16 | 北京视博数字电视科技有限公司 | Service processing method and device |
US20150085871A1 (en) * | 2013-09-25 | 2015-03-26 | RIFT.io Inc. | Dynamically scriptable ip packet processing engine |
WO2015073546A1 (en) * | 2013-11-15 | 2015-05-21 | F5 Networks, Inc. | Extending policy rulesets with scripting |
CN105188077A (en) * | 2015-08-12 | 2015-12-23 | 深圳市广和通无线股份有限公司 | Communication module test method and system |
CN105843592A (en) * | 2015-01-12 | 2016-08-10 | 芋头科技(杭州)有限公司 | System for implementing script operation in preset embedded system |
CN106202459A (en) * | 2016-07-14 | 2016-12-07 | 华南师范大学 | Relevant database storage performance optimization method under virtualized environment and system |
CN108563490A (en) * | 2018-04-13 | 2018-09-21 | 中国民航信息网络股份有限公司 | Explanation type rules process method, device, equipment and medium |
CN109063477A (en) * | 2018-07-18 | 2018-12-21 | 成都链安科技有限公司 | A kind of intelligent contract aacode defect detection system and method for automation |
CN109845226A (en) * | 2016-08-22 | 2019-06-04 | Fybr有限责任公司 | System for distributed intelligent remote sensing system |
CN110245359A (en) * | 2018-05-18 | 2019-09-17 | 谷歌有限责任公司 | Parallel decoding is carried out using autoregression machine learning model |
CN110825488A (en) * | 2019-09-29 | 2020-02-21 | 山东中创软件工程股份有限公司 | Business processing method and device, electronic equipment and storage medium |
CN111359219A (en) * | 2020-03-16 | 2020-07-03 | 网易(杭州)网络有限公司 | File processing method, device, equipment and storage medium of illusion engine |
-
2020
- 2020-11-06 CN CN202011227806.6A patent/CN112306637B/en active Active
Patent Citations (24)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7024363B1 (en) * | 1999-12-14 | 2006-04-04 | International Business Machines Corporation | Methods and apparatus for contingent transfer and execution of spoken language interfaces |
KR20060034824A (en) * | 2004-10-20 | 2006-04-26 | 주식회사 엠투미 | Method and system for providing macro service of mobile terminal using script embedded image file |
CN101138228A (en) * | 2005-01-06 | 2008-03-05 | 奥林奇股份有限公司 | Customisation of voicexml application |
EP1715413A1 (en) * | 2005-04-18 | 2006-10-25 | Research In Motion Limited | Method and system for extending scripting languages |
CN101021863A (en) * | 2006-02-13 | 2007-08-22 | 国际商业机器公司 | Method and system for annotating an audio file with an audio hyperlink |
CN101119522A (en) * | 2007-08-22 | 2008-02-06 | 中兴通讯股份有限公司 | Method for simulating AT command report |
CN101634940A (en) * | 2008-07-25 | 2010-01-27 | 苏州市蜗牛电子有限公司 | Method for developing computer games through scripts |
CN101667134A (en) * | 2009-09-23 | 2010-03-10 | 中兴通讯股份有限公司 | Method for constructing compiling system, compiling system and constructing device thereof |
CN102255674A (en) * | 2010-05-19 | 2011-11-23 | 希姆通信息技术(上海)有限公司 | LUA-script-based wireless module automatic testing method |
US20130080874A1 (en) * | 2011-09-23 | 2013-03-28 | Oracle International Corporation | Dynamic display of web page content based on a rules system |
CN103838711A (en) * | 2012-11-26 | 2014-06-04 | 上海柚艾信息技术有限公司 | Definable typed semantic parsing system and method based on rules |
US20150085871A1 (en) * | 2013-09-25 | 2015-03-26 | RIFT.io Inc. | Dynamically scriptable ip packet processing engine |
WO2015073546A1 (en) * | 2013-11-15 | 2015-05-21 | F5 Networks, Inc. | Extending policy rulesets with scripting |
CN103746873A (en) * | 2013-12-30 | 2014-04-23 | 深圳市广和通实业发展有限公司 | System and method for testing communication module |
CN103927174A (en) * | 2014-04-17 | 2014-07-16 | 北京视博数字电视科技有限公司 | Service processing method and device |
CN105843592A (en) * | 2015-01-12 | 2016-08-10 | 芋头科技(杭州)有限公司 | System for implementing script operation in preset embedded system |
CN105188077A (en) * | 2015-08-12 | 2015-12-23 | 深圳市广和通无线股份有限公司 | Communication module test method and system |
CN106202459A (en) * | 2016-07-14 | 2016-12-07 | 华南师范大学 | Relevant database storage performance optimization method under virtualized environment and system |
CN109845226A (en) * | 2016-08-22 | 2019-06-04 | Fybr有限责任公司 | System for distributed intelligent remote sensing system |
CN108563490A (en) * | 2018-04-13 | 2018-09-21 | 中国民航信息网络股份有限公司 | Explanation type rules process method, device, equipment and medium |
CN110245359A (en) * | 2018-05-18 | 2019-09-17 | 谷歌有限责任公司 | Parallel decoding is carried out using autoregression machine learning model |
CN109063477A (en) * | 2018-07-18 | 2018-12-21 | 成都链安科技有限公司 | A kind of intelligent contract aacode defect detection system and method for automation |
CN110825488A (en) * | 2019-09-29 | 2020-02-21 | 山东中创软件工程股份有限公司 | Business processing method and device, electronic equipment and storage medium |
CN111359219A (en) * | 2020-03-16 | 2020-07-03 | 网易(杭州)网络有限公司 | File processing method, device, equipment and storage medium of illusion engine |
Non-Patent Citations (5)
Title |
---|
BEIBEI SHU: "Architecture for Safe Human-Robot Collaboration: Multi-Modal Communication in Virtual Reality for Efficient Task Execution", 《2019 IEEE 28TH INTERNATIONAL SYMPOSIUM ON INDUSTRIAL ELECTRONICS (ISIE)》, 1 August 2019 (2019-08-01) * |
MICHAEL NEUMANN: "Attentive Convolutional Neural Network based Speech Emotion Recognition: A Study on the Impact of Input Features, Signal Length, and Acted Speech", 《 ARXIV》, 2 June 2017 (2017-06-02) * |
OLEKSII STAROV: "XHOUND: Quantifying the Fingerprintability of Browser Extensions", 《 2017 IEEE SYMPOSIUM ON SECURITY AND PRIVACY (SP)》, 17 June 2017 (2017-06-17) * |
张锦盛: "基于脚本驱动的应用系统开发方法", 《中国优秀硕士论文全文数据库》, 15 May 2011 (2011-05-15) * |
胡敏;杨伟民;林春晓;: "基于公共对象请求代理结构的负载测试技术研究", 上海理工大学学报, no. 02, 15 April 2007 (2007-04-15) * |
Also Published As
Publication number | Publication date |
---|---|
CN112306637B (en) | 2024-06-21 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10733017B2 (en) | Task scheduling based on performance control conditions for multiple processing units | |
US8028177B2 (en) | Method for changing power states of a computer | |
WO2019233241A1 (en) | Method and apparatus for starting application program, and storage medium and terminal | |
CN103309740A (en) | Program starting method, device and equipment | |
US11860708B2 (en) | Application processor and mobile terminal | |
US20190155368A1 (en) | Selecting a Low Power State in an Electronic Device | |
CN112437914B (en) | System recovery method and device | |
US20150365463A1 (en) | Dynamic application deployment | |
CN101526901A (en) | Method and device for viewing files in computer | |
CN113703799A (en) | Computing device and BIOS updating method and medium thereof | |
CN112711476A (en) | Computer running state management method, computing device and storage medium | |
US9411642B2 (en) | Using high priority thread to boost CPU clock rate | |
CN112261639B (en) | SIM card function configuration method, device, terminal equipment and storage medium | |
CN114237743A (en) | Interface loading method and device, electronic equipment and storage medium | |
US20220137982A1 (en) | Systems and methods for achieving faster boot times using bios attribute mitigation | |
CN112306637B (en) | Script expansion method, script expansion device, computer equipment and storage medium | |
CN106603526B (en) | WiFi/hotspot starting method and device | |
CN112667067A (en) | Payment method and device and electronic equipment | |
CN107203377B (en) | Mobile terminal and awakening method thereof | |
CN109992362B (en) | Application program processing method and device, electronic equipment and computer readable storage medium | |
US20130275739A1 (en) | Electronic apparatus, method of controlling the same, and computer-readable recording medium | |
CN109151144B (en) | Hardware management method, device, system, computer equipment and storage medium | |
US10503518B2 (en) | Initializing hardware components using parallel driver loading and serial access granting | |
US20120185713A1 (en) | Server, storage medium, and method for controlling sleep and wakeup function of the server | |
CN111857782B (en) | Interface updating method and device, computer equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |