A header file determination method and device, electronic equipment and storage medium

CN118550881BActive Publication Date: 2026-10-23WEICHAI POWER CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410824551.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-25
Publication Date
2026-10-23
Estimated Expiration
2044-06-25

AI Technical Summary

Technical Problem

命令行长度在电脑操作系统中是有限制的,并且在不同的操作系统中均存在对命令行长度的限制

Benefits of technology

[0024]本发明实施例的技术方案,通过基于接收到的头文件确定指令,确定待确定的目标头文件对应的预设搜索路径和目标头文件标识,并利用所述预设搜索路径减少搜索路径的长度和数量,从而快速确定所述预设搜索路径下的多个候选头文件;基于所述目标头文件标识和所述多个候选头文件,确定工程文件中的目标头文件,进而准确且便捷地确定头文件,提高头文件确定效率和准确性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118550881B_ABST
    Figure CN118550881B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a header file determination method and device, electronic equipment and a storage medium. The method comprises: based on a received header file determination instruction, determining a preset search path corresponding to a target header file to be determined and a target header file identifier; based on the preset search path, determining a plurality of candidate header files under the preset search path; and based on the target header file identifier and the plurality of candidate header files, determining the target header file in the engineering file. Through the technical solution of the embodiments of the present application, the header file can be accurately and conveniently determined, and the header file determination efficiency and accuracy are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a header file determination method, apparatus, electronic device and storage medium. Background Technology

[0002] When a compiler compiles code, it needs to specify a search path so that the compiler can find header files. In a computer operating system, a command line can be run to find the header files to be encoded using the search path specified in the command line. The length of the command line is limited in computer operating systems, and different operating systems have different length limits for command lines. When there are too many header files or too many paths containing header files, the search path string may become too long, causing the command line length to approach or exceed the limit, resulting in the compiler being unable to find the header files.

[0003] Currently, a common approach is to restrict the storage path of header files, reducing the number of paths that include header files, in order to address the problem of the compiler being unable to find header files due to excessively long command lines. However, this method of restricting the storage path of header files disrupts the code structure, making what should be a clear project file and its module structure chaotic. Summary of the Invention

[0004] This invention provides a header file determination method, apparatus, electronic device, and storage medium to accurately and conveniently determine header files, thereby improving the efficiency and accuracy of header file determination.

[0005] In a first aspect, embodiments of the present invention provide a header file determination method, including:

[0006] Based on the received header file determination instruction, determine the preset search path and target header file identifier corresponding to the target header file to be determined;

[0007] Based on the preset search path, multiple candidate header files under the preset search path are determined;

[0008] Based on the target header file identifier and the multiple candidate header files, the target header file in the project file is determined.

[0009] Furthermore, the method also includes: determining a target command line based on the preset search path and preset compilation instructions; and determining multiple candidate header files under the preset search path based on the target command line.

[0010] Furthermore, the method also includes: matching the target header file identifier with the filenames of the plurality of candidate header files to determine the candidate header file that matches the target header file identifier; and performing a header file search based on the candidate header file information in the candidate header file to determine the target header file in the project file.

[0011] Furthermore, the method also includes: traversing the project file to determine the file path corresponding to all files in the project file; determining candidate header file information based on the header file identifier, header file name and file path of the header file in the project file; and writing the candidate header file information into the candidate header file under the temporary search path.

[0012] Furthermore, the method also includes: determining the header file path and header file name corresponding to each header file based on the header file identifier and the file path of the header file in the project file; and determining candidate header file information based on the header file name and header file path corresponding to each header file.

[0013] Furthermore, the method also includes: the time information of the header files in the project file is the same as the time information of the candidate header files in the temporary search path.

[0014] Secondly, embodiments of the present invention also provide a header file determination device, the device comprising:

[0015] The information acquisition module is used to determine the preset search path and target header file identifier corresponding to the target header file to be determined based on the received header file determination instruction;

[0016] The candidate header file determination module is used to determine multiple candidate header files under the preset search path based on the preset search path;

[0017] The target header file determination module is used to determine the target header file in the project file based on the target header file identifier and the multiple candidate header files.

[0018] Thirdly, embodiments of the present invention also provide an electronic device, the electronic device comprising:

[0019] One or more processors;

[0020] Memory, used to store one or more programs;

[0021] When the one or more programs are executed by the one or more processors, the one or more processors implement the header file determination method provided in any embodiment of the present invention.

[0022] Fourthly, embodiments of the present invention provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the header file determination method provided in any embodiment of the present invention.

[0023] Fifthly, embodiments of the present invention provide a computer program product, including a computer program that, when executed by a processor, implements the header file determination method provided in any embodiment of the present invention.

[0024] The technical solution of this invention determines the preset search path and target header file identifier corresponding to the target header file to be determined based on the received header file determination instruction, and uses the preset search path to reduce the length and number of search paths, thereby quickly determining multiple candidate header files under the preset search path; based on the target header file identifier and the multiple candidate header files, the target header file in the project file is determined, thereby accurately and conveniently determining the header file, improving the efficiency and accuracy of header file determination.

[0025] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

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

[0027] Figure 1 This is a flowchart of a header file determination method provided in Embodiment 1 of the present invention;

[0028] Figure 2 This is an example diagram of candidate header files under a preset search path according to Embodiment 1 of the present invention;

[0029] Figure 3 This is an example diagram of candidate header file information according to Embodiment 1 of the present invention;

[0030] Figure 4 This is a flowchart of a header file determination method provided in Embodiment 2 of the present invention;

[0031] Figure 5 This is an example diagram of a portion of a file in an engineering document according to Embodiment 2 of the present invention;

[0032] Figure 6This is an example diagram of candidate header file information according to Embodiment 2 of the present invention;

[0033] Figure 7 This is a schematic diagram of the structure of a header file determination device provided in Embodiment 3 of the present invention;

[0034] Figure 8 This is a schematic diagram of the structure of an electronic device that implements the header file determination method of this invention. Detailed Implementation

[0035] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0036] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0037] Example 1

[0038] Figure 1 This document provides a flowchart of a header file determination method according to Embodiment 1 of the present invention. This embodiment is applicable to determining a specific header file in a project file. The method can be executed by a header file determination device, which can be implemented in hardware and / or software and can be configured in an electronic device. Figure 1 As shown, the method includes:

[0039] S110. Based on the received header file determination instruction, determine the preset search path and target header file identifier corresponding to the target header file to be determined.

[0040] In programming, a header file is a file containing program code (such as function declarations, macro definitions, variable declarations, etc.). Header files are commonly used in languages ​​like C and C++. The main function of header files is to provide interface declarations and modularize code, allowing different source files to share code and avoid repeatedly writing the same code blocks. Header files have specific file extensions. For example, in C++, header files can have the extension ".h" or ".hpp". A target header file can be a header file to be compiled by a compiler. A compiler is a computer program with compilation capabilities. A compiler is used to convert source code (human-readable code) written in one programming language into another language or machine code (computer-executable code). Header file determination instructions can include a preset search path for the target header file and a target header file identifier. A preset search path can refer to a pre-established temporary search path. A temporary search path can include any preset search path. A temporary search path is different from the original search path of the header file in the project file, such as the header file path. The number of strings in a temporary search path is much smaller than the number of strings in a header file path. Using temporary search paths can shorten the length and number of search paths. Project files can refer to all files included in a project. Project files can include, but are not limited to, header files (file extensions .h or .hpp), project configuration files (file extensions .dsp), and workspace files (file extensions .dsw). A target header file identifier is identification information that can be used to uniquely identify a target header file. For example, a target header file identifier can be, but is not limited to, the filename of the target header file (which may include the file extension).

[0041] Specifically, users can trigger header file determination instructions based on business needs. The compiler determines the preset search path and target header file identifier corresponding to the target header file to be determined from the received header file determination instructions.

[0042] S120. Based on the preset search path, determine multiple candidate header files under the preset search path.

[0043] Candidate header files refer to pre-configured candidate header files that correspond to the header files in the project files. These candidate header files are located in a preset search path. The filenames of the candidate header files are the same as the corresponding header files in the project files. Candidate header files can be used to find the corresponding header files within the project files.

[0044] Specifically, a preset search path is determined from the temporary search path, and multiple candidate header files are identified in the folder under the preset search path.

[0045] Based on the above technical solution, "determining multiple candidate header files under the preset search path" can include: determining the target command line based on the preset search path and preset compilation instructions; and determining multiple candidate header files under the preset search path based on the target command line.

[0046] The preset compilation instructions can refer to pre-set string instructions with path search functionality. The command line can refer to a user interface. The command line allows users to interact with a computer system or software application through text commands. Users can perform specific operations by typing commands. In this embodiment of the invention, text commands, such as target command lines, can be automatically generated based on preset search paths and preset compilation instructions. Target command lines refer to instructions that can be used to search for all header files under the preset search path.

[0047] Specifically, the preset search path is written into a reserved location in the preset compilation instructions, generating a target command line for searching the preset search path. This eliminates the need for manual command typing, improving command line generation efficiency. Running the target command line retrieves the preset search path and multiple candidate header files within it. By utilizing the shortened preset search path, excessively long search paths are avoided from negatively impacting the compiler's normal functionality, thus quickly retrieving multiple candidate header files within the preset search path and further improving the efficiency of target header file determination.

[0048] S130. Based on the target header file identifier and multiple candidate header files, determine the target header file in the project file.

[0049] Specifically, based on the target header file identifier, a specific header file corresponding to the target header file identifier is determined from multiple candidate header files, and the target header file in the project file corresponding to the specific header file is determined by using the correspondence between the specific header file and the header files in the project file.

[0050] Based on the above technical solution, "determining the target header file in the project file based on the target header file identifier and multiple candidate header files" may include: matching the target header file identifier with the filenames of multiple candidate header files to determine the candidate header file that matches the target header file identifier; and performing header file search based on the candidate header file information in the candidate header files to determine the target header file in the project file.

[0051] Here, "candidate header file" can refer to any candidate header file that matches the target header file identifier. "Candidate header file information" can refer to the file content contained within the candidate header file. For example, candidate header file information can include the header file path and filename of the target header file in the project file.

[0052] Specifically, the target header file identifier is matched with the filenames of multiple candidate header files to identify the candidate header file whose filename matches the target header file identifier. Based on the candidate header file information, a header file search is performed to determine the target header file in the project file. Then, using the candidate header file information written in the candidate header files, the target header file required by the business logic is retrieved from the project file in a join-like manner.

[0053] It should be noted that the target header file determined by the header file determination method in the embodiments of the present invention can be used normally for code writing, compilation and debugging in the integrated development environment (IDE), and can jump to the original code file normally when compilation errors or warnings occur.

[0054] For example, let's take the target header file's default search path as "Tmp\3_Header" and the target header file identifier (Port_MemMap.h) as an example. The target command line generated using the default search path (Tmp\3_Header) and the default compilation instructions is "gcc.exe -co Port.o-ITmp\3_Header". The default compilation instructions use the "-I" symbol to specify the header file search path. Running the target command line identifies multiple candidate header files under the default search path. Figure 2 An example diagram of candidate header files under a preset search path is given.

[0055] The candidate header file is determined from multiple candidate header files using the target header file identifier (Port_MemMap.h). Figure 3 An example diagram of candidate header file information is provided. See also... Figure 3 The candidate header file information is `#include"Input / Code / Rte / Integration / MCAL / Memmap / Port MemMap.h"`. Here, `#include"Input / Code / Rte / Integration / MCAL / Memmap"` is the path to the target header file in the project file, and `Port MemMap.h` is the filename of the target header file in the project file. The target header file in the project file is determined by searching for the candidate header file information.

[0056] It's important to note that in a program, using "#include" to include header files allows the compiler to insert the contents of the header file (the candidate header file) into the source file (the object header file) that includes that content during compilation. When processing code files, the compiler uses "#include" to locate a set of directory paths for the header files.

[0057] The technical solution of this invention determines the preset search path and target header file identifier corresponding to the target header file to be determined based on the received header file determination instruction, and reduces the length and number of search paths by using the preset search path, thereby quickly determining multiple candidate header files under the preset search path; based on the target header file identifier and multiple candidate header files, the target header file in the project file is determined, thereby accurately and conveniently determining the header file, improving the efficiency and accuracy of header file determination.

[0058] Example 2

[0059] Figure 4 This is a flowchart of a header file determination method provided in Embodiment 2 of the present invention. Based on the above embodiments, this embodiment describes in detail the process of determining candidate header files. Explanations of terms that are the same as or corresponding to those in the above embodiments are not repeated here. Figure 4 As shown, the method includes:

[0060] S410. Traverse the project files and determine the file paths corresponding to all files in the project files.

[0061] The full file can refer to all files contained in the project file. Figure 5 This displays a portion of the files in the project file. The file path can refer to the file search path for each file in the entire project file.

[0062] Specifically, it iterates through the project files and determines the file path corresponding to each file in the project files.

[0063] S420. Based on the header file identifier, header file name, and file path of the header file in the project file, determine the candidate header file information.

[0064] The header file identifier is used to uniquely identify all header files in the project file. The header file identifier can refer to unique identification information that distinguishes a header file from other files. For example, the header file identifier can be, but is not limited to, the file extension (.h or .hpp) of the header file in the project file. The header file name can refer to the file name (including the file extension) of the header file in the project file. Candidate header file information can refer to the file content that will be written into the candidate header files. The candidate header file information can include the header file identifier and the file path corresponding to that header file identifier. Figure 6 An example of candidate header file information is given.

[0065] Specifically, the file paths corresponding to all files are filtered by the header file identifiers of the header files in the project file, thereby determining the file paths of all header files in the project file, and candidate header file information is formed based on each header file name and the file path corresponding to each header file name in the file paths of all header files.

[0066] Based on the above technical solution, "determining candidate header file information based on the header file identifier, header file name, and file path of the header files in the project file" can include: determining the header file path and header file name corresponding to each header file based on the header file identifier and file path of the header files in the project file; and determining candidate header file information based on the header file name and header file path corresponding to each header file.

[0067] Specifically, the file path and file name of each header file in the project file are determined based on the header file identifier. For each header file in the project file, candidate header file information corresponding to the current header file is constructed using the current header file name and header file path, so that the current header file can be found through the candidate header file information.

[0068] S430. Write the candidate header file information to the candidate header files in the temporary search path.

[0069] The candidate header file, containing specific candidate header file information, has the same filename as the specific header file in the project file. The temporary search path for candidate header files can be within the project file or exist independently of it. See also... Figure 2 , Figure 2 This example demonstrates candidate header files in a pre-defined search path within a pre-set temporary search path.

[0070] Specifically, based on a preset writing method, candidate header file information is written to candidate header files in a temporary search path. For example, candidate header file information is written to candidate header files in the temporary search path using "#include". The written candidate header file contains "#include"Input / Code / Rte / Integration / MCAL / Memmap / Port MemMap.h".

[0071] Based on the above technical solution, the time information of the header files in the project file is the same as the time information of the candidate header files in the temporary search path.

[0072] After the project files are completed, the compiler can compile all target header files in the same batch to complete the compilation. However, if the header files in the project files are adjusted, only the adjusted header files need to be compiled again, and the compilation results of the previous batch should be specifically overwritten. This approach allows for batch differentiation using time information, enabling targeted compilation operations, avoiding redundant compilation, and further improving compilation efficiency.

[0073] S440. Based on the received header file determination instruction, determine the preset search path and target header file identifier corresponding to the target header file to be determined.

[0074] S450. Based on the preset search path, determine multiple candidate header files under the preset search path.

[0075] S460. Based on the target header file identifier and multiple candidate header files, determine the target header file in the project file.

[0076] For example, after the compiler accurately determines the target header file in the project file, the compiler's compilation function can be used to compile the target header file.

[0077] The technical solution of this invention involves traversing the project file to determine the file paths corresponding to all files in the project file; determining candidate header file information based on the header file identifiers and file paths of the header files in the project file; and writing the candidate header file information into the candidate header files under a temporary search path. This allows for shortening the length and reducing the number of search paths through a pre-set temporary search path, eliminating the need to restrict the header file storage path, such as by separately defining header file storage rules. While ensuring the modular structure of the project file, this solution addresses the problem of excessively long search path strings and command line lengths approaching or exceeding the length limit, which prevents the compiler from finding header files.

[0078] The following are embodiments of the header file determination device provided in this invention. This device and the header file determination methods in the above embodiments belong to the same inventive concept. For details not described in detail in the embodiments of the header file determination device, please refer to the embodiments of the header file determination methods described above.

[0079] Example 3

[0080] Figure 7 This is a schematic diagram of a header file determination device provided in Embodiment 3 of the present invention. Figure 7 As shown, the device includes: an information acquisition module 710, a candidate header file determination module 720, and a target header file determination module 730.

[0081] The information acquisition module 710 is used to determine the preset search path and target header file identifier corresponding to the target header file to be determined based on the received header file determination instruction; the candidate header file determination module 720 is used to determine multiple candidate header files under the preset search path based on the preset search path; and the target header file determination module 730 is used to determine the target header file in the project file based on the target header file identifier and multiple candidate header files.

[0082] The technical solution of this invention determines the preset search path and target header file identifier corresponding to the target header file to be determined based on the received header file determination instruction, and reduces the length and number of search paths by using the preset search path, thereby quickly determining multiple candidate header files under the preset search path; based on the target header file identifier and multiple candidate header files, the target header file in the project file is determined, thereby accurately and conveniently determining the header file, improving the efficiency and accuracy of header file determination.

[0083] Based on the above technical solution, the candidate header file determination module 720 is specifically used to: determine the target command line based on the preset search path and preset compilation instructions; and determine multiple candidate header files under the preset search path based on the target command line.

[0084] Based on the above technical solution, the target header file determination module 730 is specifically used to: match the target header file identifier with the filenames of multiple candidate header files to determine the candidate header file that matches the target header file identifier; and perform header file search based on the candidate header file information in the candidate header file to determine the target header file in the project file.

[0085] Based on the above technical solution, the device also includes:

[0086] The file path determination module is used to traverse the project files and determine the file paths corresponding to all files in the project files.

[0087] The candidate header file information determination module is used to determine candidate header file information based on the header file identifier, header file name, and file path of the header files in the project file;

[0088] The candidate header file determination module is used to write candidate header file information to candidate header files in a temporary search path.

[0089] Based on the above technical solution, the candidate header file information determination module is specifically used to: determine the header file path and header file name corresponding to each header file based on the header file identifier and file path of the header files in the project file; and determine the candidate header file information based on the header file name and header file path corresponding to each header file.

[0090] Based on the above technical solution, the time information of the header files in the project file is the same as the time information of the candidate header files in the temporary search path.

[0091] The header file determination device provided in the embodiments of the present invention can execute the header file determination method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of executing the header file determination method.

[0092] It is worth noting that in the embodiments defined in the above header file, the various units and modules included are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the scope of protection of the present invention.

[0093] Example 4

[0094] Figure 8 A schematic diagram of an electronic device 10 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0095] like Figure 8As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0096] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0097] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as the header file determination method.

[0098] In some embodiments, the header file determination method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the header file determination method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the header file determination method by any other suitable means (e.g., by means of firmware).

[0099] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0100] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0101] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0102] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0103] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0104] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0105] This invention also provides a computer program product, including a computer program that, when executed by a processor, implements the header file determination method provided in any embodiment of this application.

[0106] In implementing the computer program product, computer program code for performing the operations of this invention can be written in one or more programming languages ​​or a combination thereof. Programming languages ​​include object-oriented programming languages ​​such as Java, Smalltalk, and C++, as well as conventional procedural programming languages ​​such as C or similar languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider). This program product belongs to the same inventive concept as the header file determination method disclosed in the embodiments of this application, and therefore will not be described further here.

[0107] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0108] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A method for determining header files, characterized in that, include: Based on the received header file determination instruction, determine the preset search path and target header file identifier corresponding to the target header file to be determined; Based on the preset search path, multiple candidate header files under the preset search path are determined; the preset search path is a pre-established temporary search path, which is different from the original search path of the header file in the project file, and the number of strings in the temporary search path is less than the number of strings in the header file path. Based on the target header file identifier and the multiple candidate header files, the target header file in the project file is determined; The method further includes: Traverse the project files and determine the file paths corresponding to all files in the project files; Based on the header file identifier and the file path of the header file in the project file, determine the header file path and header file name corresponding to each header file; Based on the header file name and header file path corresponding to each header file, determine the candidate header file information; Write the candidate header file information into the candidate header files under the temporary search path.

2. The method according to claim 1, characterized in that, The step of determining multiple candidate header files under the preset search path based on the preset search path includes: Based on the preset search path and preset compilation instructions, the target command line is determined; Based on the target command line, multiple candidate header files under the preset search path are determined.

3. The method according to claim 1, characterized in that, The step of determining the target header file in the project file based on the target header file identifier and the plurality of candidate header files includes: Based on the target header file identifier, the filenames of the multiple candidate header files are matched to determine the candidate header file that matches the target header file identifier; Based on the candidate header file information in the candidate header files, a header file search is performed to determine the target header file in the project file.

4. The method according to claim 1, characterized in that, The time information of the header files in the project file is the same as the time information of the candidate header files in the temporary search path.

5. A header file determination device, characterized in that, The device includes: The information acquisition module is used to determine the preset search path and target header file identifier corresponding to the target header file to be determined based on the received header file determination instruction; The candidate header file determination module is used to determine multiple candidate header files under the preset search path based on the preset search path; the preset search path is a pre-established temporary search path, which is different from the original search path of the header file in the project file, and the number of strings in the temporary search path is less than the number of strings in the header file path. The target header file determination module is used to determine the target header file in the project file based on the target header file identifier and the multiple candidate header files; The device further includes: The file path determination module is used to traverse the project files and determine the file paths corresponding to all files in the project files. The candidate header file information determination module is used to determine candidate header file information based on the header file identifier, header file name, and file path of the header files in the project file; The candidate header file determination module is used to write the candidate header file information into the candidate header files under the temporary search path; Specifically, the candidate header file information determination module is used to: determine the header file path and header file name corresponding to each header file based on the header file identifier and the file path of the header file in the project file; and determine candidate header file information based on the header file name and header file path corresponding to each header file.

6. An electronic device, characterized in that, The electronic device includes: One or more processors; Memory, used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the header file determination method as described in any one of claims 1-4.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the header file determination method as described in any one of claims 1-4.

8. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the header file determination method as described in any one of claims 1-4.

Citation Information

Patent Citations

  • Data processing method based on annotation, computer equipment and readable storage medium

    CN114721713A

  • Service pack generation method and device, electronic equipment and storage medium

    CN116755744A