CN112256279B - Source code conversion method, source code conversion device, computer equipment and readable storage medium - Google Patents

Source code conversion method, source code conversion device, computer equipment and readable storage medium Download PDF

Info

Publication number
CN112256279B
CN112256279B CN202011045973.9A CN202011045973A CN112256279B CN 112256279 B CN112256279 B CN 112256279B CN 202011045973 A CN202011045973 A CN 202011045973A CN 112256279 B CN112256279 B CN 112256279B
Authority
CN
China
Prior art keywords
source code
driving frame
attribute information
frame source
initial driving
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.)
Active
Application number
CN202011045973.9A
Other languages
Chinese (zh)
Other versions
CN112256279A (en
Inventor
吴豪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fibocom Wireless Inc
Original Assignee
Fibocom Wireless Inc
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Fibocom Wireless Inc filed Critical Fibocom Wireless Inc
Priority to CN202011045973.9A priority Critical patent/CN112256279B/en
Publication of CN112256279A publication Critical patent/CN112256279A/en
Application granted granted Critical
Publication of CN112256279B publication Critical patent/CN112256279B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/51Source to source
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4411Configuring for operating with peripheral devices; Loading of device drivers

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Stored Programmes (AREA)

Abstract

The application relates to a source code conversion method, a source code conversion device, computer equipment and a readable storage medium. The method comprises the following steps: receiving a source code conversion tool opening instruction, responding to the source code conversion tool opening instruction, identifying the source code of the initial driving frame to obtain an identification result, and converting the source code of the initial driving frame into a source code of the target driving frame according to the identification result; according to the method, the original driving frame source codes can be automatically converted into target driving frame source codes through the source code conversion tool, so that manual rewriting of the driving frame source codes by a developer is avoided, and the conversion efficiency of different driving frame source codes is improved.

Description

Source code conversion method, source code conversion device, computer equipment and readable storage medium
Technical Field
The present application relates to the field of operating systems, and in particular, to a method and apparatus for converting source codes, a computer device, and a readable storage medium.
Background
Windows and Linux are the most common two operating systems at present, and different operating systems only have driving frame source codes under corresponding environments to realize corresponding functions. For a cross-platform operating system, both Windows and Linux drive frame source codes can be executed, so that in the operating system, the conversion between the Windows drive frame source codes and the Linux drive frame source codes is needed to be realized so as to meet the actual requirements of the cross-platform operating system.
In the traditional technology, the current cross-platform operating system is configured with Windows driving frame source codes, and if the cross-platform operating system currently needs to execute the Linux driving frame source codes, a developer can rewrite the Windows driving frame source codes into the Linux driving frame source codes under a development environment so as to meet the requirements of the current cross-platform operating system. However, the conventional source code conversion method can reduce the conversion efficiency of source codes of different driving frameworks.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a source code conversion method, apparatus, computer device, and readable storage medium that can improve source code conversion efficiency of different driving frameworks.
A method of source code conversion, the method comprising:
receiving a source code conversion tool opening instruction;
Responding to the source code conversion tool opening instruction, and carrying out identification processing on the source code of the initial driving frame to obtain an identification result; the identification result comprises first attribute information of functions and second attribute information of data contained in the initial driving frame source codes;
And converting the initial driving frame source code into target driving frame source code according to the identification result.
In one embodiment, the responding to the source code conversion tool opening instruction performs recognition processing on source codes of the initial driving frame to obtain a recognition result, and includes:
Identifying the application program interface function in the initial driving frame source code to obtain first attribute information;
carrying out recognition processing on the data in the source code of the initial driving frame to obtain second attribute information;
Wherein the first attribute information characterizes a type of application program interface function and the second attribute information characterizes a type of data.
In one embodiment, the identifying the application program interface function in the source code of the initial driving frame to obtain the first attribute information includes:
traversing each application program interface function in the initial driving frame source code, and identifying the traversed application program interface function to obtain the first attribute information;
The identifying the data in the source code of the initial driving frame to obtain second attribute information includes:
Traversing each data in the initial driving frame source codes, and identifying the traversed data to obtain the second attribute information.
In one embodiment, the converting the initial driving frame source code into the target driving frame source code according to the identification result includes:
Judging whether the identification result meets the source code conversion requirement or not; the source code conversion requirement characterizes that the first attribute information and the second attribute information in the identification result accord with a preset conversion standard of the source code of the driving frame to be converted;
And if yes, converting the initial driving frame source code into the target driving frame source code.
In one embodiment, the method further comprises:
if the first driving frame source code does not meet the first editing instruction, editing and modifying the initial driving frame source code according to the acquired first editing instruction to obtain a first driving frame source code, and converting the first driving frame source code into the target driving frame source code.
In one embodiment, the method further comprises:
Editing and modifying an initial driving function file in the first driving frame source code according to the acquired second editing instruction to obtain a second driving frame source code, and converting the second driving frame source code into the target driving frame source code; the second driving frame source code comprises an initial driving function file after editing and modifying.
In one embodiment, the method further comprises:
displaying the edited and modified initial driving function file to generate a visual function module;
Judging whether the visual function module meets the actual requirement of a driving function file or not; the actual requirement of the driving function file represents that the driving function file to be converted accords with a preset function standard;
if the visual function module does not meet the requirement, deleting the visual function module, acquiring a third driving frame source code, and converting the third driving frame source code into the target driving frame source code.
A source code conversion apparatus, the apparatus comprising:
The instruction receiving module is used for receiving a source code conversion tool opening instruction;
The identification module is used for responding to the opening instruction of the source code conversion tool and carrying out identification processing on the source code of the initial driving frame to obtain an identification result; the identification result comprises first attribute information of functions and second attribute information of data contained in the initial driving frame source codes;
and the conversion module is used for converting the initial driving frame source code into a target driving frame source code according to the identification result.
A computer device comprising a memory storing a computer program and a processor which when executing the computer program performs the steps of:
receiving a source code conversion tool opening instruction;
Responding to the source code conversion tool opening instruction, and carrying out identification processing on the source code of the initial driving frame to obtain an identification result; the identification result comprises first attribute information of functions and second attribute information of data contained in the initial driving frame source codes;
And converting the initial driving frame source code into target driving frame source code according to the identification result.
A readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
receiving a source code conversion tool opening instruction;
Responding to the source code conversion tool opening instruction, and carrying out identification processing on the source code of the initial driving frame to obtain an identification result; the identification result comprises first attribute information of functions and second attribute information of data contained in the initial driving frame source codes;
And converting the initial driving frame source code into target driving frame source code according to the identification result.
The method receives a source code conversion tool opening instruction, responds to the source code conversion tool opening instruction, performs identification processing on the source code of the initial driving frame to obtain an identification result, and converts the source code of the initial driving frame into a target driving frame source code according to the identification result; according to the method, the original driving frame source codes can be automatically converted into target driving frame source codes through the source code conversion tool, so that manual rewriting of the driving frame source codes by a developer is avoided, and the conversion efficiency of different driving frame source codes is improved.
Drawings
FIG. 1 is a flow chart of a source code conversion method according to an embodiment;
FIG. 2 is a schematic diagram of a specific flow of an identification process in one embodiment;
FIG. 3 is a flowchart of a source code conversion method according to another embodiment;
FIG. 4 is a flowchart illustrating source code conversion according to another embodiment;
FIG. 5 is a schematic diagram of a source code conversion device according to an embodiment;
Fig. 6 is an internal structural diagram of a computer device in one embodiment.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
The source code conversion method provided by the application can be applied to computer equipment, and the computer equipment can provide a set of independent integrated development environment to realize a cross-platform operating system, so that the Windows driving frame source code and the Linux driving frame source code can be operated. Alternatively, the computer device may be an electronic device having a source code editing function, such as a PC, a portable device, a server, or the like. The specific procedure of the source code conversion method will be specifically described in the following embodiments. In this embodiment, a set of source code conversion tools may be installed on the computer device, so as to implement a source code conversion method by using the source code conversion tools, and specific procedures of the source code conversion method will be described in the following embodiments.
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
Fig. 1 is a flow chart of a source code conversion method according to an embodiment. The present embodiment relates to a process of converting source codes of an initial driving frame, and is described by taking application of the method to computer equipment as an example. As shown in fig. 1, the method includes:
s1000, receiving a source code conversion tool opening instruction.
Specifically, a source code conversion tool can be installed on the computer equipment, and the source code conversion tool can be used for mutually converting source codes of different driving frames; under the source code conversion tool, the computer equipment can be configured with Windows driving frame source codes and Linux driving frame source codes so as to realize the mutual conversion between the Windows driving frame source codes and the Linux driving frame source codes. If the project demands that the current computer equipment needs to execute the source codes of the target driving frames, the computer equipment can receive a source code conversion tool opening instruction input by a user so as to realize source code conversion of different driving frames through the source code conversion tool; the source code of the target driving frame is different from the source code of the initial driving frame currently configured by the computer, and the input mode of the opening instruction of the source code conversion tool can comprise input modes such as voice broadcasting, function menu triggering, shortcut key and the like. For example, the voice broadcast input form may be understood as that a user inputs voice information, and the computer device recognizes the voice information to determine that the voice information is related information of an opening instruction of the source code conversion tool; the function menu triggering input form can be understood as that a user clicks an open function menu displayed on a source code conversion tool interface on the computer equipment through a mouse; the shortcut key input form can be a shortcut key corresponding to an opening instruction of a source code conversion tool input by a user through a function key on a keyboard.
S2000, responding to the source code conversion tool opening instruction, and carrying out identification processing on the source code of the initial driving frame to obtain an identification result; the identification result comprises first attribute information of functions and second attribute information of data contained in the initial driving frame source codes.
Specifically, the computer device may open a directory of source codes of the initial driving frame executed by the current computer device, and respond to the received source code conversion tool opening instruction, and automatically identify the source codes of the initial driving frame through pattern recognition according to the directory structure and the suffix of the file name displayed in the directory. The catalog of the source code of the initial driving framework executed by the current computer equipment can be displayed in the integrated development environment of the computer equipment; the method for obtaining the suffix of the file name displayed in the directory may be to traverse all the subdirectories displayed in the directory structure and all the files under the subdirectories one by one, so as to obtain the suffix of the file name.
The initial driving frame source code includes information such as an application program interface function, data, a key variable name, a macro name, a name of each initial driving function file and a key callback function name included in the initial driving frame source code, so the identification information may include attribute information of the application program interface function, attribute information of the data, attribute information of the key variable name, and attribute information of the macro name. In this embodiment, the identification result may include first attribute information of a function in source code of the initial driving frame and second attribute information of data; the first attribute information may include information of a type of a function, a function of the function, a parameter included in the function, and the like, and the second attribute information may include information of a type of data, a function of the data, and the like. Optionally, the identification result may be displayed on a display interface of the computer device, so that a developer knows information corresponding to each initial driving function file included in the current initial driving frame source code. The functions, key variable names, macro names, etc. may be displayed on a display interface of the computer device in a grammatically highlighted form.
S3000, converting the initial driving frame source code into a target driving frame source code according to the identification result.
Specifically, the computer device may automatically convert the initial driving frame source code into the target driving frame source code according to the recognition result. The functions and data included in the source code of the initial driving frame and the source code of the target driving frame can be different.
In the source code conversion method, a source code conversion tool opening instruction is received, an initial driving frame source code is identified and processed to obtain an identification result in response to the source code conversion tool opening instruction, and the initial driving frame source code is converted into a target driving frame source code according to the identification result; according to the method, the initial driving frame source codes can be automatically converted into target driving frame source codes through the source code conversion tool, so that a developer is prevented from manually rewriting the driving frame source codes, the conversion efficiency of different driving frame source codes is improved, convenience is provided for the developer, the conversion time is shortened, and the complexity of source code conversion is reduced.
As one embodiment, as shown in fig. 2, the step of identifying the source code of the initial driving frame in response to the source code conversion tool opening instruction to obtain an identification result may be implemented by the following steps:
And S2100, performing identification processing on the application program interface function in the source code of the initial driving framework to obtain first attribute information. Wherein the first attribute information characterizes a type of application program interface function.
Specifically, after responding to the source code conversion tool opening instruction, the computer device may use the neural network model to identify the application program interface function in the source code of the initial driving framework, determine the first attribute information of the application program interface function, where the first attribute information of the application program interface function characterizes the type of the application program interface function. In this embodiment, the type of the application program interface function in the source code of the initial driving framework may be different from the type of the application program interface function in the source code of the target driving framework.
The step in S2100 may specifically include: traversing each application program interface function in the initial driving frame source code, and identifying the traversed application program interface function to obtain the first attribute information.
In this embodiment, the computer device may traverse each application program interface function in the source code of the initial driving frame, and perform identification processing on the traversed application program interface function to obtain the first attribute information. Alternatively, the above-mentioned traversing manner may be understood as traversing sequentially according to a sequential order, or traversing sequentially according to other preset orders. Optionally, the source code conversion tool may encapsulate the corresponding recognition processing method to perform step S2100, so as to improve the recognition rate and accuracy of the recognition processing of the source code conversion tool.
S2200, carrying out identification processing on the data in the source code of the initial driving frame to obtain second attribute information. Wherein the second attribute information characterizes a type of data.
It can be understood that the computer device may further perform recognition processing on the data in the source code of the initial driving frame by using the neural network model, so as to obtain second attribute information of the data, where the second attribute information characterizes a type of the data. In this embodiment, the type of data in the source code of the initial driving frame may be different from the type of data in the source code of the target driving frame. Optionally, the source code conversion tool may also encapsulate a corresponding recognition processing method to execute step S2200, so as to improve the recognition rate and accuracy of the recognition processing of the source code conversion tool, where the recognition processing manner in the step of encapsulating the source code conversion tool and the recognition processing manner in step S2100 of encapsulating are different modules, and there may be no association between the two.
The step in S2200 may specifically include: traversing each data in the initial driving frame source codes, and identifying the traversed data to obtain the second attribute information.
Specifically, the computer device may traverse each data in the source code of the initial driving frame, and perform recognition processing on the traversed data to obtain the first attribute information. The manner of traversal in this step may be the same as or different from that in step S2100.
In this embodiment, the source code conversion tool may be understood as a functional plug-in installed on a computer device, and different functional menus of the functional plug-in may be displayed in a pull-down menu displayed after the source code conversion tool is opened; the function menu may include a driving frame source code on/off menu, an project on/off menu, an edit menu, a driving function file attribute view menu, a driving frame source code compile menu, a driving frame source code debug menu, an interactive menu, a setup information menu, etc.; the embodiment can realize the source code conversion function by triggering the interactive menu, and can set the parameters, types and other information of source code conversion after triggering the information setting menu; after triggering the menu with different functions, the result after realizing the corresponding functions can be displayed on a visual interface (i.e. a display interface of the computer equipment). After the source code conversion is finished, a driving frame source code compiling menu and a driving frame source code debugging menu can be triggered to compile and debug the target driving frame source code; the execution source code compiling can compile and link the source code of the target driving framework to generate a computer executable file and a file with binary suffix of sys or ko; and further debugging the source code of the target driving frame, and analyzing whether the vulnerability exists in the source code of the target driving frame through single-step operation, breakpoint operation and the like. The implementation of the editing, compiling and debugging functions of the source code conversion tool can be understood as the editing function of the integrated development environment, and a developer can modify, add, delete and the like the source code of the driving frame.
The source code conversion tool has the function of creating a source code program besides the function of source code conversion; after a developer triggers a new source code function menu, the display interface of the computer equipment can display a guide interface, the information displayed by the guide interface is used for guiding the developer to create a customized driver, and finally, a visual interaction interface is displayed, and the customized driver is edited on the visual interaction interface; when a developer edits the customized driver on the visual interaction interface, a driver function file prestored in the computer device is added, wherein the driver function file comprises a general driver basic file such as a driver entry function file, an initialization function file, a PNP management file, a power management file, an interrupt file and the like, and each driver function file comprises a driver of a corresponding function.
It will also be appreciated that the source code conversion tool may also provide various types of related visualization windows, such as: editing window, debugging window, printing information window, conversion guide window, driving function file attribute viewing window, visual function module attribute drag-and-drop window, etc.; the window may be implemented using modal/non-modal window information.
According to the source code conversion method, after the source code conversion tool is started, the attribute information of the functions and the data contained in the source codes of the initial driving frame can be automatically identified, and the type of the source codes of the current initial driving frame is further determined according to the attribute information, so that the source codes of the initial driving frame are converted into the source codes of the target driving frame, a developer is prevented from manually rewriting the source codes of the driving frame, the conversion efficiency of the source codes of different driving frames is improved, convenience is provided for the developer, the conversion time is shortened, and the complexity of source code conversion is reduced.
In another embodiment, as shown in fig. 3, the step of converting the initial driving frame source code into the target driving frame source code in S3000 according to the identification result may be implemented by the following steps:
S3100, judging whether the identification result meets the source code conversion requirement or not; the source code conversion requirement characterizes that the first attribute information and the second attribute information in the identification result accord with a preset conversion standard of the source code of the driving frame to be converted.
Specifically, the computer device may determine, according to the obtained recognition result, whether the recognition result meets a preset conversion standard of the source code of the driving frame to be converted. That is, before the drive frame source code conversion process, it is required to determine whether the information in the initial drive frame source code can be directly converted into the information in the target drive frame source code, if so, the first attribute information and the second attribute information in the characterization recognition result conform to the preset conversion standard of the drive frame source code to be converted, and if not, the first attribute information and the second attribute information in the characterization recognition result do not conform to the preset conversion standard of the drive frame source code to be converted.
S3200, if the source code of the initial driving frame is met, converting the source code of the initial driving frame into the source code of the target driving frame.
It can be understood that if the computer device determines that the recognition result meets the source code conversion requirement, the source code of the initial driving frame can be directly converted into the source code of the target driving frame.
According to the source code conversion method, the initial driving frame source codes can be directly converted into the target driving frame source codes, manual rewriting of the driving frame source codes by a developer is avoided, conversion efficiency of different driving frame source codes is improved, convenience is provided for the developer, conversion time is shortened, and complexity of source code conversion is reduced.
As another example, with continued reference to fig. 3, after step S3100, the method may further include:
S3300, if not, editing and modifying the initial driving frame source code according to the acquired first editing instruction to obtain a first driving frame source code, and converting the first driving frame source code into the target driving frame source code.
Specifically, if the computer device determines that the identification result does not meet the source code conversion requirement, the computer device may receive a first editing instruction, respond to the first editing instruction to edit and modify the source code of the initial driving frame, obtain the source code of the first driving frame, and convert the source code of the first driving frame into the source code of the target driving frame when information included in the source code of the first driving frame meets the source code conversion requirement. The information included in the first driving frame source code may include attribute information of a function included in the first driving frame source code and attribute information of data. After the computer equipment judges that the identification result does not meet the source code conversion requirement, a window can be popped up on a display interface of the computer equipment, the judgment result is displayed, and a developer is prompted to input a first editing instruction so as to edit and modify the source code of the initial driving frame; the input mode of the first editing instruction can be input modes such as voice broadcasting, function menu triggering and shortcut keys. Optionally, after the developer inputs the first editing instruction, the display interface of the computer device may pop up a visual interface to display the source code of the initial driving frame.
Further, after step S3300, the method may further include: editing and modifying an initial driving function file in the first driving frame source code according to the acquired second editing instruction to obtain a second driving frame source code, and converting the second driving frame source code into the target driving frame source code; the second driving frame source code comprises an initial driving function file after editing and modifying.
It can be understood that, when the information contained in the first driving frame source code does not meet the source code conversion requirement, the computer device may further receive a second editing instruction, and respond to the second editing instruction to edit and modify one or more initial driving function files in the first driving frame source code, so as to obtain a second driving frame source code, and when the information contained in the second driving frame source code meets the source code conversion requirement, convert the second driving frame source code into the target driving frame source code. The information included in the second driving frame source code may include attribute information of a function and attribute information of data included in the second driving frame source code.
In this embodiment, after the computer device determines that the information included in the source code of the first driving frame does not meet the source code conversion requirement, the display interface of the computer device may pop up a window, display the determination result, and prompt the developer to input a second editing instruction, so as to continuously edit and modify the initial driving function file in the source code of the first driving frame; the input mode of the first editing instruction can be input modes such as voice broadcasting, function menu triggering and shortcut keys. The initial driving function file may include a general driving basic file item such as a driving entry function file, an initializing function file, a PNP management file, a power management file, etc., and each initial driving function file has a corresponding implementation function. Optionally, after the developer inputs the second editing instruction, the display interface of the computer device may pop up a visual interface to display the source code of the first driving frame.
In addition, as shown in fig. 4, after the step of editing and modifying the initial driving function file in the source code of the first driving framework, the method may further include the steps of:
s3400, displaying the edited and modified initial driving function file to generate a visual function module.
Specifically, the computer device may display the edited and modified initial driving function file, and may also display the unedited and modified initial driving function file, so as to generate a visual function module. The visual function modules can be displayed in corresponding windows on a display interface of the computer equipment, and each driving function file corresponds to one visual function module.
S3500, judging whether the visual function module meets the actual requirement of the driving function file; the actual requirement of the driving function file represents that the driving function file to be converted accords with a preset function standard.
In this embodiment, the computer device may determine whether each visualization function module meets the actual requirement of the driving function file; the actual requirement of the driving function file can be understood that the visual function module accords with the preset function standard of the driving function file to be converted, which is specified in the project requirement. Wherein the computer device may prompt the determination; the prompting mode may include a visual function module flashing mode, a mode of displaying a judgment result on a display interface, and the like.
S3600, deleting the visual function module if the visual function module is not satisfied, acquiring a third driving frame source code, and converting the third driving frame source code into the target driving frame source code.
Specifically, when the computer device determines that the visual function module does not meet the actual requirement of the driving function file, the computer device may receive a deletion instruction of a different function module, delete the visual function module that does not meet the actual requirement of the driving function file, and combine the initial driving function file corresponding to the undeleted visual function module or the edited and modified initial driving function file to generate a third driving frame source code, where information included in the third driving frame source code meets the source code conversion requirement, and further convert the third driving frame source code into a target driving frame source code. In this embodiment, the purpose of editing and modifying the driving frame source code before conversion is to obtain the target driving frame source code after conversion processing as the driving frame source code of the project requirement, so that editing and modifying the driving frame source code after conversion is not required, and the computer device can directly run.
In addition, when the visual function module does not meet the actual requirement of the driving function file, the computer equipment can also characterize that the driving function file contained in the driving frame source code generated after the current editing and modification does not meet the actual requirement of the driving function file, and adds other driving function files meeting the actual requirement of the driving function file into the driving frame source code generated after the editing and modification, so that the added driving function file is displayed on a visual interface in a visual mode, or the driving function file corresponding to the visual function module which does not meet the actual requirement of the driving function file is edited and modified, so that the visual function module corresponding to the modified driving function file meets the actual requirement. The driving function file can be added to further shorten the source code writing time and improve the source code conversion efficiency. In this embodiment, the visual function module may implement the above-described deletion, addition, and modification functions through the drag-and-drop attribute; the drag-and-drop attribute can be realized in a component form to avoid instability of a corresponding driver of a source code conversion tool caused by instability of each component, and the attribute also provides easy-to-use operation for developers.
According to the source code conversion method, the initial driving frame source codes or the initial driving function files in the initial driving frame source codes can be edited and modified, and then the driving frame source codes generated after editing and modification are converted to generate the target driving frame source codes, so that manual rewriting of the driving frame source codes by a developer can be avoided, the conversion efficiency of different driving frame source codes is improved, convenience is provided for the developer, the conversion time is shortened, and the complexity of source code conversion is reduced.
It should be understood that, although the steps in the flowcharts of fig. 1-4 are shown in order as indicated by the arrows, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in FIGS. 1-4 may include multiple steps or stages that are not necessarily performed at the same time, but may be performed at different times, nor do the order in which the steps or stages are performed necessarily performed in sequence, but may be performed alternately or alternately with at least a portion of the steps or stages in other steps or other steps.
Fig. 5 is a schematic structural diagram of a source code conversion device according to an embodiment. As shown in fig. 5, the apparatus may include: an instruction receiving module 11, an identifying module 12 and a converting module 13.
Specifically, the instruction receiving module 11 is configured to receive a source code conversion tool opening instruction;
The identification module 12 is configured to respond to the source code conversion tool opening instruction, and perform identification processing on the source code of the initial driving frame to obtain an identification result; the identification result comprises first attribute information of functions and second attribute information of data contained in the initial driving frame source codes;
the conversion module 13 is configured to convert the initial driving frame source code into a target driving frame source code according to the identification result.
The source code conversion device provided in this embodiment may execute the above method embodiment, and its implementation principle and technical effects are similar, and will not be described herein.
In one embodiment, the identification module 12 includes: the first recognition unit and the second recognition unit.
Specifically, the first identifying unit is configured to identify an application program interface function in the source code of the initial driving frame, so as to obtain first attribute information;
The second identification unit is used for carrying out identification processing on the data in the initial driving frame source code to obtain second attribute information;
Wherein the first attribute information characterizes a type of application program interface function and the second attribute information characterizes a type of data.
The source code conversion device provided in this embodiment may execute the above method embodiment, and its implementation principle and technical effects are similar, and will not be described herein.
In one embodiment, the first identifying unit is specifically configured to traverse each application program interface function in the initial driving frame source code, and identify the traversed application program interface function, so as to obtain the first attribute information;
The second identifying unit is specifically configured to traverse each data in the source code of the initial driving frame, and identify the traversed data to obtain the second attribute information.
The source code conversion device provided in this embodiment may execute the above method embodiment, and its implementation principle and technical effects are similar, and will not be described herein.
In one embodiment, the conversion module 13 includes: a judging unit and a first converting unit.
Specifically, the judging unit is configured to judge whether the identification result meets a source code conversion requirement; the source code conversion requirement characterizes that the first attribute information and the second attribute information in the identification result accord with a preset conversion standard of the source code of the driving frame to be converted;
And the first conversion unit is used for converting the initial driving frame source code into the target driving frame source code when the judging result of the judging unit is satisfied.
The source code conversion device provided in this embodiment may execute the above method embodiment, and its implementation principle and technical effects are similar, and will not be described herein.
In one embodiment, the conversion module 13 further comprises: and a second conversion unit.
And the second conversion unit is used for editing and modifying the initial driving frame source code according to the acquired first editing instruction when the judging result of the judging unit is not satisfied, so as to obtain a first driving frame source code, and converting the first driving frame source code into the target driving frame source code.
The source code conversion device provided in this embodiment may execute the above method embodiment, and its implementation principle and technical effects are similar, and will not be described herein.
In one embodiment, the conversion module 13 further comprises: and a third conversion unit.
The third conversion unit is used for editing and modifying the initial driving function file in the first driving frame source code according to the acquired second editing instruction to obtain a second driving frame source code, and converting the second driving frame source code into the target driving frame source code; the second driving frame source code comprises an initial driving function file after editing and modifying.
The source code conversion device provided in this embodiment may execute the above method embodiment, and its implementation principle and technical effects are similar, and will not be described herein.
The specific limitation of the source code conversion device can be referred to above for the limitation of the source code conversion method, and will not be described herein. The above-described respective modules in the source code conversion apparatus may be implemented in whole or in part by software, hardware, or a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the terminal, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 6. The computer device includes a processor, a memory, and a network interface 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 includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program, when executed by a processor, implements a source code conversion method.
It will be appreciated by those skilled in the art that the structure shown in fig. 6 is merely a block diagram of a portion of the structure associated with the present inventive arrangements and is not limiting of the terminal to which the present inventive arrangements are applied, and that a particular terminal may include more or fewer components than shown, or may combine some of the 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 stored therein a computer program, the processor when executing the computer program performing the steps of:
receiving a source code conversion tool opening instruction;
Responding to the source code conversion tool opening instruction, and carrying out identification processing on the source code of the initial driving frame to obtain an identification result; the identification result comprises first attribute information of functions and second attribute information of data contained in the initial driving frame source codes;
And converting the initial driving frame source code into target driving frame source code according to the identification result.
In one embodiment, a readable storage medium is provided having a computer program stored thereon, which when executed by a processor, performs the steps of:
receiving a source code conversion tool opening instruction;
Responding to the source code conversion tool opening instruction, and carrying out identification processing on the source code of the initial driving frame to obtain an identification result; the identification result comprises first attribute information of functions and second attribute information of data contained in the initial driving frame source codes;
And converting the initial driving frame source code into target driving frame source code according to the identification result.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, or the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory. By way of illustration, and not limitation, RAM can be in various forms such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), etc.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples illustrate only a few embodiments of the application, which are described in detail and are not to be construed as limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of protection of the present application is to be determined by the appended claims.

Claims (9)

1. A method for source code conversion, the method comprising:
receiving a source code conversion tool opening instruction;
Responding to the source code conversion tool opening instruction, and carrying out identification processing on the source code of the initial driving frame to obtain an identification result; the identification result comprises first attribute information of functions and second attribute information of data contained in the initial driving frame source codes;
according to the identification result, converting the initial driving frame source code into a target driving frame source code;
And responding to the source code conversion tool opening instruction, and identifying the source code of the initial driving frame to obtain an identification result, wherein the method comprises the following steps:
Identifying the application program interface function in the initial driving frame source code to obtain first attribute information;
carrying out recognition processing on the data in the source code of the initial driving frame to obtain second attribute information;
Wherein the first attribute information characterizes the type of the application program interface function and the second attribute information characterizes the type of the data;
The identifying the application program interface function in the initial driving frame source code to obtain first attribute information includes:
traversing each application program interface function in the initial driving frame source code, and identifying the traversed application program interface function to obtain the first attribute information;
The identifying the data in the source code of the initial driving frame to obtain second attribute information includes:
traversing each data in the initial driving frame source code, and identifying the traversed data to obtain the second attribute information;
The step of converting the initial driving frame source code into target driving frame source code according to the identification result comprises the following steps:
Judging whether the identification result meets the source code conversion requirement or not; the source code conversion requirement characterizes that the first attribute information and the second attribute information in the identification result accord with a preset conversion standard of the source code of the driving frame to be converted;
And if yes, converting the initial driving frame source code into the target driving frame source code.
2. The method according to claim 1, wherein the method further comprises:
if the first driving frame source code does not meet the first editing instruction, editing and modifying the initial driving frame source code according to the acquired first editing instruction to obtain a first driving frame source code, and converting the first driving frame source code into the target driving frame source code.
3. The method according to any one of claims 1-2, wherein the method further comprises:
Editing and modifying an initial driving function file in the first driving frame source code according to the acquired second editing instruction to obtain a second driving frame source code, and converting the second driving frame source code into the target driving frame source code; the second driving frame source code comprises an initial driving function file after editing and modifying.
4. The method according to claim 2, wherein the method further comprises:
displaying the edited and modified initial driving function file to generate a visual function module;
Judging whether the visual function module meets the actual requirement of a driving function file or not; the actual requirement of the driving function file represents that the driving function file to be converted accords with a preset function standard;
if the visual function module does not meet the requirement, deleting the visual function module, acquiring a third driving frame source code, and converting the third driving frame source code into the target driving frame source code.
5. A source code conversion apparatus, the apparatus comprising:
The instruction receiving module is used for receiving a source code conversion tool opening instruction;
The identification module is used for responding to the opening instruction of the source code conversion tool and carrying out identification processing on the source code of the initial driving frame to obtain an identification result; the identification result comprises first attribute information of functions and second attribute information of data contained in the initial driving frame source codes;
The conversion module is used for converting the initial driving frame source code into a target driving frame source code according to the identification result;
The identification module comprises a first identification unit and a second identification unit; the first identification unit is used for carrying out identification processing on the application program interface function in the initial driving frame source code to obtain first attribute information;
The second identification unit is used for carrying out identification processing on the data in the initial driving frame source code to obtain second attribute information;
Wherein the first attribute information characterizes the type of the application program interface function and the second attribute information characterizes the type of the data;
The first identification unit is specifically configured to traverse each application program interface function in the source code of the initial driving frame, and identify the traversed application program interface function, so as to obtain the first attribute information;
the second identification unit is specifically configured to traverse each data in the source code of the initial driving frame, and perform identification processing on the traversed data to obtain the second attribute information;
the conversion module includes: a judging unit and a first converting unit; the judging unit is used for judging whether the identification result meets the source code conversion requirement or not; the source code conversion requirement characterizes that the first attribute information and the second attribute information in the identification result accord with a preset conversion standard of the source code of the driving frame to be converted;
And the first conversion unit is used for converting the initial driving frame source code into the target driving frame source code when the judging result of the judging unit is satisfied.
6. The apparatus of claim 5, wherein the conversion module further comprises a second conversion unit, the second conversion unit is configured to edit and modify the initial driving frame source code according to the obtained first editing instruction to obtain a first driving frame source code, and convert the first driving frame source code into the target driving frame source code when the determination result of the determination unit is not satisfied.
7. The apparatus of claim 5, wherein the conversion module further comprises a third conversion unit, the third conversion unit is configured to edit and modify an initial driving function file in the first driving frame source code according to the acquired second editing instruction, obtain a second driving frame source code, and convert the second driving frame source code into the target driving frame source code; the second driving frame source code comprises an initial driving function file after editing and modifying.
8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 4 when the computer program is executed.
9. A readable storage medium having stored thereon a computer program, which when executed by a processor realizes the steps of the method according to any of claims 1 to 4.
CN202011045973.9A 2020-09-29 2020-09-29 Source code conversion method, source code conversion device, computer equipment and readable storage medium Active CN112256279B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011045973.9A CN112256279B (en) 2020-09-29 2020-09-29 Source code conversion method, source code conversion device, computer equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011045973.9A CN112256279B (en) 2020-09-29 2020-09-29 Source code conversion method, source code conversion device, computer equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN112256279A CN112256279A (en) 2021-01-22
CN112256279B true CN112256279B (en) 2024-05-14

Family

ID=74234461

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011045973.9A Active CN112256279B (en) 2020-09-29 2020-09-29 Source code conversion method, source code conversion device, computer equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN112256279B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107247603A (en) * 2017-04-18 2017-10-13 深圳市广和通无线股份有限公司 Support the remote upgrade method and system of firmware auto restore facility
CN107861728A (en) * 2017-10-25 2018-03-30 深圳四方精创资讯股份有限公司 Method from traditional program language to modern procedures language conversion and its system for
CN107908394A (en) * 2017-11-21 2018-04-13 中国电子科技集团公司第五十四研究所 A kind of data interchange format source code generation method and instrument
CN109598107A (en) * 2018-11-20 2019-04-09 江苏通付盾信息安全技术有限公司 A kind of code conversion method and device based on application installation package file
CN110543297A (en) * 2018-05-28 2019-12-06 北京京东尚科信息技术有限公司 method and apparatus for generating source code
CN111158689A (en) * 2019-12-30 2020-05-15 深圳Tcl数字技术有限公司 Cross-system UI application generation method, device and computer-readable storage medium
CN111309486A (en) * 2018-08-10 2020-06-19 中科寒武纪科技股份有限公司 Conversion method, conversion device, computer equipment and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107247603A (en) * 2017-04-18 2017-10-13 深圳市广和通无线股份有限公司 Support the remote upgrade method and system of firmware auto restore facility
CN107861728A (en) * 2017-10-25 2018-03-30 深圳四方精创资讯股份有限公司 Method from traditional program language to modern procedures language conversion and its system for
CN107908394A (en) * 2017-11-21 2018-04-13 中国电子科技集团公司第五十四研究所 A kind of data interchange format source code generation method and instrument
CN110543297A (en) * 2018-05-28 2019-12-06 北京京东尚科信息技术有限公司 method and apparatus for generating source code
CN111309486A (en) * 2018-08-10 2020-06-19 中科寒武纪科技股份有限公司 Conversion method, conversion device, computer equipment and storage medium
CN109598107A (en) * 2018-11-20 2019-04-09 江苏通付盾信息安全技术有限公司 A kind of code conversion method and device based on application installation package file
CN111158689A (en) * 2019-12-30 2020-05-15 深圳Tcl数字技术有限公司 Cross-system UI application generation method, device and computer-readable storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
A.T. Lawniczak等.Netzwerk: migration of a packet-switching network simulation environment from MS Windows PC to Linux PC and to HPC.《19th International Symposium on High Performance Computing Systems and Applications (HPCS'05)》.2005,第280 - 286页. *
一种基于模型的应用程序跨平台转换方法;李世峰等;《计算机与数字工程》(第10期);第1549-1551+1575页 *

Also Published As

Publication number Publication date
CN112256279A (en) 2021-01-22

Similar Documents

Publication Publication Date Title
KR101885089B1 (en) Excel export method for bim design files
CN111722840A (en) Command library creating method, device, medium and equipment for RPA flow generating end
US20100309212A1 (en) Platform agnostic screen capture tool
CN111061489B (en) Multi-platform compiling detection method, device, equipment and medium
CN110659027A (en) Code generation method and device and electronic equipment
CN113961196A (en) Method, device and equipment for automatically generating codes and readable storage medium
CN115658529A (en) Automatic testing method for user page and related equipment
CN111966357A (en) Operating system application compiling method and device and electronic equipment
CN110543299A (en) Cloud computing management platform code generation method and device
CN115048104A (en) Code generation method and device based on syntax tree and electronic equipment
CN113434134B (en) Component processing method and device, electronic equipment and storage medium
CN112231197A (en) Page testing method and device and storage medium
CN114003269A (en) Component processing method and device, electronic equipment and storage medium
CN112256279B (en) Source code conversion method, source code conversion device, computer equipment and readable storage medium
CN110874216A (en) Complete code generation method, device, equipment and storage medium
CN110045952B (en) Code calling method and device
CN113590564B (en) Data storage method, device, electronic equipment and storage medium
CN115437608A (en) Intelligent research and development assisting method and device
CN117667052A (en) Visual processing method, device and system for front-end business logic
KR101476536B1 (en) The method and system for inspecting program
CN113807698A (en) Work order generation method and device, electronic equipment and readable storage medium
CN114371986A (en) User interface test case updating method, device and storage medium
US20180267680A1 (en) Screen creation apparatus, simulation apparatus and recording medium
CN113126979B (en) Visual business building system capable of achieving secondary programming by separating from server
CN114546480B (en) Code automatic integration method, device and readable 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