US9298480B2 - Programmatic editing of text files - Google Patents

Programmatic editing of text files Download PDF

Info

Publication number
US9298480B2
US9298480B2 US12/394,008 US39400809A US9298480B2 US 9298480 B2 US9298480 B2 US 9298480B2 US 39400809 A US39400809 A US 39400809A US 9298480 B2 US9298480 B2 US 9298480B2
Authority
US
United States
Prior art keywords
text file
tree structure
file
processing device
text
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, expires
Application number
US12/394,008
Other versions
US20100218200A1 (en
Inventor
David Lutterkort
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.)
Red Hat Inc
Original Assignee
Red Hat 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 Red Hat Inc filed Critical Red Hat Inc
Priority to US12/394,008 priority Critical patent/US9298480B2/en
Assigned to RED HAT, INC. reassignment RED HAT, INC. ASSIGNMENT OF ASSIGNORS INTEREST (SEE DOCUMENT FOR DETAILS). Assignors: LUTTERKORT, DAVID
Publication of US20100218200A1 publication Critical patent/US20100218200A1/en
Application granted granted Critical
Publication of US9298480B2 publication Critical patent/US9298480B2/en
Active legal-status Critical Current
Adjusted expiration legal-status Critical

Links

Images

Classifications

    • 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/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files

Definitions

  • Embodiments of the present invention relate to computing systems, and more particularly, to changing structured text files that can be described by a formal grammar.
  • Structured text files e.g. the files that are typically used to store configuration data on Unix-style machines, often need to be modified by other programs. For many of them, no tool that can exploit the structure of these files is readily available, even though, given that they can be described by a formal grammar, it is possible to map the contents of such files into a data structure more amenable to accessing from programs than just flat text files.
  • FIG. 1 is a block diagram illustrating one embodiment of an overall architecture for manipulating a text file through an API file.
  • FIG. 2 is a block diagram illustrating one embodiment of a node of a tree.
  • FIG. 3 is a block diagram illustrating one embodiment of a tree.
  • FIG. 4 is a block diagram illustrating one embodiment of an apparatus for editing configuration text files.
  • FIG. 5 is a block diagram illustrating one embodiment of the configuration editing tool.
  • FIG. 6 is a flow diagram illustrating one embodiment of a method for editing configuration text files.
  • FIG. 7 is a block diagram illustrating an example of a computer system.
  • a file format corresponding to a text file is identified.
  • the text file is parsed into a tree structure with the corresponding file format.
  • the tree structure is modified with an Application Program Interface (API).
  • API Application Program Interface
  • the text file is updated to reflect the modified tree structure while preserving the file format of the text file and leaving those parts of the file unchanged that correspond to portions of the tree that were not changed.
  • the description of the file format includes instructions on how each entry in the text file is to be mapped into the tree structure. Not all of the content from the text file has to be present in the tree, for example, whitespace and other formatting details are generally not represented in the tree, but are restored upon saving the modified tree.
  • FIG. 1 is a block diagram illustrating one embodiment of an overall architecture for manipulating a text file through an API file.
  • An editing tool 106 parses text files 108 in their native formats and transforms them into a tree 104 .
  • a local configuration API 102 manipulates tree 104 and saves it back into text files 108 .
  • the local editing API 102 presents structured text as a tree.
  • the tree is backed only by the text file, without the need for additional lookaside information.
  • the editing tool 106 takes great care to preserve comments and formatting details, so that changes to tree 104 change the underlying text file in ways that are intuitive, easy to predict, and as close as possible to how a human would make the same change manually.
  • the transformation from configuration files 108 into tree 104 , and from the updated tree 104 back to an updated file 108 is controlled by a description of each configuration file.
  • the description is itself a text file and consists of a specification of the file format and instructions on how each entry in the file is to be mapped into the tree 104 in a domain-specific language.
  • Descriptions for new file formats can be added in a modular fashion; this makes it possible to distribute file format descriptions separately from the editing tool.
  • a lens consists of two mappings, one from text to tree (called “get”), and one from modified tree and original text to modified text (called “put”), relieving the developer of keeping those two transformations synchronized.
  • the two mappings comprising a lens are tied together by conditions that ensure that the two mappings embody intuitive notions of a roundtrip from text to tree and back to text. Lenses are statically type-checked so that a large number of problems can be diagnosed based on the lens only, preventing whole classes of errors at runtime when the lens is applied to actual text.
  • API 102 includes a simple command line tool that can be used for simple changes from shell scripts, as well as a C library API, and bindings for Perl, Python, Ruby, Ocaml and Java.
  • C library API bindings for Perl, Python, Ruby, Ocaml and Java.
  • file format descriptions for many common Linux configuration files are also provided.
  • FIG. 2 is a block diagram illustrating one embodiment of a node of a tree created by the editing tool.
  • Each node in the tree consists of three pieces of data: a label 204 , a value 206 , and a list of sibling nodes 202 and child nodes 208 .
  • the label and value are both strings.
  • the label is used in the path to the node and child nodes, much as file names are used in the paths to files in a file system.
  • FIG. 3 is a block diagram illustrating one embodiment of a tree with the nodes of FIG. 2 .
  • a node 302 has a child node 304 .
  • Child node 304 has sibling nodes 306 , 308 , 310 .
  • a node can have multiple children with the same label.
  • a node can have any number of children called foo.
  • FIG. 4 is a block diagram illustrating one embodiment of an apparatus 400 for editing structured text files.
  • Apparatus 400 includes applications 402 , configuration editing tool 404 , configuration and text files 406 , API 408 , and operating system 410 .
  • Editing tool 404 allows a user to edit or modify configuration files 406 . Editing tool 404 is described in more detail with respect to FIG. 5 .
  • FIG. 5 is a block diagram illustrating one embodiment of the editing tool 404 .
  • Editing tool 404 includes API 502 , lenses 504 and a tree 512 .
  • Lenses are the building blocks of the file to and from tree transformation. They combine parsing a text file and building the tree with “get” transformation, and turning the tree back into an updated text file with the “put” transformation.
  • a bidirectional language is one where the program expresses a transformation from input to output, and from (possibly modified) output back to the corresponding input. They are called bidirectional rather than bijective because there are generally many inputs for the same output.
  • Lenses 504 perform the parsing between the tree and the text file. For example, the parsing is performed with the lenses matching regular expressions. Different lenses do different things with the strings that match (create a new tree node with a certain label, store a value in a tree node, combine tree nodes into a larger tree). Other lenses are used to combine simpler lenses into more complicated ones, for example, to express iteration or concatenation.
  • FIG. 6 is a flow diagram illustrating one embodiment of a method for editing text files.
  • a file format corresponding to a text file is identified.
  • the text file is parsed into a tree structure with the corresponding file format.
  • the tree structure is modified using an Application Program Interface (API).
  • API Application Program Interface
  • the text file is bidirectionally updated to reflect the modified tree structure while preserving formatting details of the original text file.
  • the file format includes instructions on how each entry in the text file is to be mapped into the tree structure.
  • the API includes a command line tool to manipulate the text file from a shell.
  • mapping includes parsing the text file with a get function to produce the tree structure, and transforming the tree structure back into the text file with a put and create function.
  • FIG. 7 illustrates a diagrammatic representation of a machine in the exemplary form of a computer system 700 within which a set of instructions, for causing the machine to perform any one or more of the methodologies discussed herein, may be executed.
  • the machine may be connected (e.g., networked) to other machines in a LAN, an intranet, an extranet, or the Internet.
  • the machine may operate in the capacity of a server or a client machine in client-server network environment, or as a peer machine in a peer-to-peer (or distributed) network environment.
  • the machine may be a personal computer (PC), a tablet PC, a set-top box (STB), a Personal Digital Assistant (PDA), a cellular telephone, a web appliance, a server, a network router, switch or bridge, or any machine capable of executing a set of instructions (sequential or otherwise) that specify actions to be taken by that machine.
  • PC personal computer
  • PDA Personal Digital Assistant
  • STB set-top box
  • WPA Personal Digital Assistant
  • a cellular telephone a web appliance
  • server a server
  • network router switch or bridge
  • the exemplary computer system 700 includes a processing device 702 , a main memory 704 (e.g., read-only memory (ROM), flash memory, dynamic random access memory (DRAM) such as synchronous DRAM (SDRAM), a static memory 706 (e.g., flash memory, static random access memory (SRAM), etc.), and a data storage device 718 , which communicate with each other via a bus 730 .
  • main memory 704 e.g., read-only memory (ROM), flash memory, dynamic random access memory (DRAM) such as synchronous DRAM (SDRAM), a static memory 706 (e.g., flash memory, static random access memory (SRAM), etc.
  • SDRAM synchronous DRAM
  • static memory 706 e.g., flash memory, static random access memory (SRAM), etc.
  • SRAM static random access memory
  • Processing device 702 represents one or more general-purpose processing devices such as a microprocessor, central processing unit, or the like. More particularly, the processing device may be complex instruction set computing (CISC) microprocessor, reduced instruction set computing (RISC) microprocessor, very long instruction word (VLIW) microprocessor, or processor implementing other instruction sets, or processors implementing a combination of instruction sets. Processing device 702 may also be one or more special-purpose processing devices such as an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), a digital signal processor (DSP), network processor, or the like. The processing device 702 is configured to execute modules 726 (previously described with respect to FIG. 1 ) for performing the operations and steps discussed herein with. In one embodiment, the modules may be include hardware or software or a combination of both.
  • CISC complex instruction set computing
  • RISC reduced instruction set computing
  • VLIW very long instruction word
  • ASIC application specific integrated circuit
  • FPGA field programmable gate array
  • DSP digital signal
  • the computer system 700 may further include a network interface device 708 .
  • the computer system 700 also may include a video display unit 710 (e.g., a liquid crystal display (LCD) or a cathode ray tube (CRT)), an alphanumeric input device 712 (e.g., a keyboard), a cursor control device 714 (e.g., a mouse), and a signal generation device 716 (e.g., a speaker).
  • a video display unit 710 e.g., a liquid crystal display (LCD) or a cathode ray tube (CRT)
  • an alphanumeric input device 712 e.g., a keyboard
  • a cursor control device 714 e.g., a mouse
  • a signal generation device 716 e.g., a speaker
  • the data storage device 718 may include a computer-accessible storage medium 730 on which is stored one or more sets of instructions (e.g., software 722 ) embodying any one or more of the methodologies or functions described herein.
  • the software 722 may also reside, completely or at least partially, within the main memory 704 and/or within the processing device 702 during execution thereof by the computer system 700 , the main memory 704 and the processing device 702 also constituting computer-accessible storage media.
  • the software 722 may further be transmitted or received over a network 720 via the network interface device 708 .
  • the computer-accessible storage medium 730 may also be used to store the configuration editing tool 724 as presently described.
  • the configuration editing tool 724 may also be stored in other sections of computer system 700 , such as static memory 706 .
  • While the computer-accessible storage medium 730 is shown in an exemplary embodiment to be a single medium, the term “computer-accessible storage medium” should be taken to include a single medium or multiple media (e.g., a centralized or distributed database, and/or associated caches and servers) that store the one or more sets of instructions.
  • the term “computer-accessible storage medium” shall also be taken to include any medium that is capable of storing, encoding or carrying a set of instructions for execution by the machine and that cause the machine to perform any one or more of the methodologies of the present invention.
  • the term “computer-accessible storage medium” shall accordingly be taken to include, but not be limited to, solid-state memories, optical and magnetic media.
  • the present invention also relates to apparatus for performing the operations herein.
  • This apparatus may be specially constructed for the required purposes, or it may comprise a general purpose computer selectively activated or reconfigured by a computer program stored in the computer.
  • a computer program may be stored in a computer readable storage medium, such as, but is not limited to, any type of disk including floppy disks, optical disks, CD-ROMs, and magnetic-optical disks, read-only memories (ROMs), random access memories (RAMs), EPROMs, EEPROMs, magnetic or optical cards, or any type of media suitable for storing electronic instructions, and each coupled to a computer system bus.

Abstract

A file format corresponding to a text file is identified. The text file is parsed into a tree structure with the corresponding file format. The tree structure is modified with an Application Program Interface (API) module. The text file is bidirectionally updated to reflect the modified tree structure while preserving the file format of the text file. The file format includes instructions on how each entry in the text file is to be mapped into the tree structure.

Description

RELATED APPLICATIONS
The present application is related to co-pending application Ser. No. 12/394,006, entitled “Method for programmatic editing of configuration Files”, filed on Feb. 26, 2009.
TECHNICAL FIELD
Embodiments of the present invention relate to computing systems, and more particularly, to changing structured text files that can be described by a formal grammar.
BACKGROUND
Structured text files, e.g. the files that are typically used to store configuration data on Unix-style machines, often need to be modified by other programs. For many of them, no tool that can exploit the structure of these files is readily available, even though, given that they can be described by a formal grammar, it is possible to map the contents of such files into a data structure more amenable to accessing from programs than just flat text files.
Even though there is a wealth of structured text files in common use and even though they can readily be described with a formal grammar to aid further processing, such grammars are generally not available. It is often quite feasible to reverse-engineer such a grammar, but lacking generic tools to process files described by a reverse-engineered grammar into a simple data structure, the effort usually outweighs the benefits.
BRIEF DESCRIPTION OF THE DRAWINGS
The present invention is illustrated by way of example, and not by way of limitation, in the figures of the accompanying drawings and in which:
FIG. 1 is a block diagram illustrating one embodiment of an overall architecture for manipulating a text file through an API file.
FIG. 2 is a block diagram illustrating one embodiment of a node of a tree.
FIG. 3 is a block diagram illustrating one embodiment of a tree.
FIG. 4 is a block diagram illustrating one embodiment of an apparatus for editing configuration text files.
FIG. 5 is a block diagram illustrating one embodiment of the configuration editing tool.
FIG. 6 is a flow diagram illustrating one embodiment of a method for editing configuration text files.
FIG. 7 is a block diagram illustrating an example of a computer system.
DETAILED DESCRIPTION
Described herein is a method and apparatus for editing text files with different formats. In one embodiment, a file format corresponding to a text file is identified. The text file is parsed into a tree structure with the corresponding file format. The tree structure is modified with an Application Program Interface (API). The text file is updated to reflect the modified tree structure while preserving the file format of the text file and leaving those parts of the file unchanged that correspond to portions of the tree that were not changed.
The description of the file format includes instructions on how each entry in the text file is to be mapped into the tree structure. Not all of the content from the text file has to be present in the tree, for example, whitespace and other formatting details are generally not represented in the tree, but are restored upon saving the modified tree.
FIG. 1 is a block diagram illustrating one embodiment of an overall architecture for manipulating a text file through an API file. An editing tool 106 parses text files 108 in their native formats and transforms them into a tree 104. A local configuration API 102 manipulates tree 104 and saves it back into text files 108.
The local editing API 102 presents structured text as a tree. The tree is backed only by the text file, without the need for additional lookaside information. The editing tool 106 takes great care to preserve comments and formatting details, so that changes to tree 104 change the underlying text file in ways that are intuitive, easy to predict, and as close as possible to how a human would make the same change manually.
How elements of the text file are classified as comments and content to be mapped into the tree is controlled solely by the description of the file format, and not built into the tool. Classification of text elements can therefore be controlled entirely by the user of the tool.
The transformation from configuration files 108 into tree 104, and from the updated tree 104 back to an updated file 108 is controlled by a description of each configuration file. The description is itself a text file and consists of a specification of the file format and instructions on how each entry in the file is to be mapped into the tree 104 in a domain-specific language.
Descriptions for new file formats can be added in a modular fashion; this makes it possible to distribute file format descriptions separately from the editing tool.
The file format description consists for the most part of a lens 106. A lens consists of two mappings, one from text to tree (called “get”), and one from modified tree and original text to modified text (called “put”), relieving the developer of keeping those two transformations synchronized. The two mappings comprising a lens are tied together by conditions that ensure that the two mappings embody intuitive notions of a roundtrip from text to tree and back to text. Lenses are statically type-checked so that a large number of problems can be diagnosed based on the lens only, preventing whole classes of errors at runtime when the lens is applied to actual text. In one embodiment, API 102 includes a simple command line tool that can be used for simple changes from shell scripts, as well as a C library API, and bindings for Perl, Python, Ruby, Ocaml and Java. In that embodiment, file format descriptions for many common Linux configuration files are also provided.
FIG. 2 is a block diagram illustrating one embodiment of a node of a tree created by the editing tool. Each node in the tree consists of three pieces of data: a label 204, a value 206, and a list of sibling nodes 202 and child nodes 208. The label and value are both strings. The label is used in the path to the node and child nodes, much as file names are used in the paths to files in a file system.
FIG. 3 is a block diagram illustrating one embodiment of a tree with the nodes of FIG. 2. A node 302 has a child node 304. Child node 304 has sibling nodes 306, 308, 310. A node can have multiple children with the same label. A node can have any number of children called foo.
FIG. 4 is a block diagram illustrating one embodiment of an apparatus 400 for editing structured text files. Apparatus 400 includes applications 402, configuration editing tool 404, configuration and text files 406, API 408, and operating system 410. Editing tool 404 allows a user to edit or modify configuration files 406. Editing tool 404 is described in more detail with respect to FIG. 5.
FIG. 5 is a block diagram illustrating one embodiment of the editing tool 404. Editing tool 404 includes API 502, lenses 504 and a tree 512. Lenses are the building blocks of the file to and from tree transformation. They combine parsing a text file and building the tree with “get” transformation, and turning the tree back into an updated text file with the “put” transformation.
A bidirectional language is one where the program expresses a transformation from input to output, and from (possibly modified) output back to the corresponding input. They are called bidirectional rather than bijective because there are generally many inputs for the same output.
Lenses 504 perform the parsing between the tree and the text file. For example, the parsing is performed with the lenses matching regular expressions. Different lenses do different things with the strings that match (create a new tree node with a certain label, store a value in a tree node, combine tree nodes into a larger tree). Other lenses are used to combine simpler lenses into more complicated ones, for example, to express iteration or concatenation.
FIG. 6 is a flow diagram illustrating one embodiment of a method for editing text files. At 602, a file format corresponding to a text file is identified. At 604, the text file is parsed into a tree structure with the corresponding file format. At 606, the tree structure is modified using an Application Program Interface (API). At 608 the text file is bidirectionally updated to reflect the modified tree structure while preserving formatting details of the original text file.
In one embodiment, the file format includes instructions on how each entry in the text file is to be mapped into the tree structure. The API includes a command line tool to manipulate the text file from a shell.
In another embodiment, mapping includes parsing the text file with a get function to produce the tree structure, and transforming the tree structure back into the text file with a put and create function.
FIG. 7 illustrates a diagrammatic representation of a machine in the exemplary form of a computer system 700 within which a set of instructions, for causing the machine to perform any one or more of the methodologies discussed herein, may be executed. In alternative embodiments, the machine may be connected (e.g., networked) to other machines in a LAN, an intranet, an extranet, or the Internet. The machine may operate in the capacity of a server or a client machine in client-server network environment, or as a peer machine in a peer-to-peer (or distributed) network environment. The machine may be a personal computer (PC), a tablet PC, a set-top box (STB), a Personal Digital Assistant (PDA), a cellular telephone, a web appliance, a server, a network router, switch or bridge, or any machine capable of executing a set of instructions (sequential or otherwise) that specify actions to be taken by that machine. Further, while only a single machine is illustrated, the term “machine” shall also be taken to include any collection of machines that individually or jointly execute a set (or multiple sets) of instructions to perform any one or more of the methodologies discussed herein.
The exemplary computer system 700 includes a processing device 702, a main memory 704 (e.g., read-only memory (ROM), flash memory, dynamic random access memory (DRAM) such as synchronous DRAM (SDRAM), a static memory 706 (e.g., flash memory, static random access memory (SRAM), etc.), and a data storage device 718, which communicate with each other via a bus 730.
Processing device 702 represents one or more general-purpose processing devices such as a microprocessor, central processing unit, or the like. More particularly, the processing device may be complex instruction set computing (CISC) microprocessor, reduced instruction set computing (RISC) microprocessor, very long instruction word (VLIW) microprocessor, or processor implementing other instruction sets, or processors implementing a combination of instruction sets. Processing device 702 may also be one or more special-purpose processing devices such as an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), a digital signal processor (DSP), network processor, or the like. The processing device 702 is configured to execute modules 726 (previously described with respect to FIG. 1) for performing the operations and steps discussed herein with. In one embodiment, the modules may be include hardware or software or a combination of both.
The computer system 700 may further include a network interface device 708. The computer system 700 also may include a video display unit 710 (e.g., a liquid crystal display (LCD) or a cathode ray tube (CRT)), an alphanumeric input device 712 (e.g., a keyboard), a cursor control device 714 (e.g., a mouse), and a signal generation device 716 (e.g., a speaker).
The data storage device 718 may include a computer-accessible storage medium 730 on which is stored one or more sets of instructions (e.g., software 722) embodying any one or more of the methodologies or functions described herein. The software 722 may also reside, completely or at least partially, within the main memory 704 and/or within the processing device 702 during execution thereof by the computer system 700, the main memory 704 and the processing device 702 also constituting computer-accessible storage media. The software 722 may further be transmitted or received over a network 720 via the network interface device 708.
The computer-accessible storage medium 730 may also be used to store the configuration editing tool 724 as presently described. The configuration editing tool 724 may also be stored in other sections of computer system 700, such as static memory 706.
While the computer-accessible storage medium 730 is shown in an exemplary embodiment to be a single medium, the term “computer-accessible storage medium” should be taken to include a single medium or multiple media (e.g., a centralized or distributed database, and/or associated caches and servers) that store the one or more sets of instructions. The term “computer-accessible storage medium” shall also be taken to include any medium that is capable of storing, encoding or carrying a set of instructions for execution by the machine and that cause the machine to perform any one or more of the methodologies of the present invention. The term “computer-accessible storage medium” shall accordingly be taken to include, but not be limited to, solid-state memories, optical and magnetic media.
In the above description, numerous details are set forth. It will be apparent, however, to one skilled in the art, that the present invention may be practiced without these specific details. In some instances, well-known structures and devices are shown in block diagram form, rather than in detail, in order to avoid obscuring the present invention.
Some portions of the detailed descriptions above are presented in terms of algorithms and symbolic representations of operations on data bits within a computer memory. These algorithmic descriptions and representations are the means used by those skilled in the data processing arts to most effectively convey the substance of their work to others skilled in the art. An algorithm is here, and generally, conceived to be a self-consistent sequence of steps leading to a desired result. The steps are those requiring physical manipulations of physical quantities. Usually, though not necessarily, these quantities take the form of electrical or magnetic signals capable of being stored, transferred, combined, compared, and otherwise manipulated. It has proven convenient at times, principally for reasons of common usage, to refer to these signals as bits, values, elements, symbols, characters, terms, numbers, or the like.
It should be borne in mind, however, that all of these and similar terms are to be associated with the appropriate physical quantities and are merely convenient labels applied to these quantities. Unless specifically stated otherwise as apparent from the following discussion, it is appreciated that throughout the description, discussions utilizing terms such as “processing” or “computing” or “calculating” or “determining” or “displaying” or the like, refer to the action and processes of a computer system, or similar electronic computing device, that manipulates and transforms data represented as physical (electronic) quantities within the computer system's registers and memories into other data similarly represented as physical quantities within the computer system memories or registers or other such information storage, transmission or display devices.
The present invention also relates to apparatus for performing the operations herein. This apparatus may be specially constructed for the required purposes, or it may comprise a general purpose computer selectively activated or reconfigured by a computer program stored in the computer. Such a computer program may be stored in a computer readable storage medium, such as, but is not limited to, any type of disk including floppy disks, optical disks, CD-ROMs, and magnetic-optical disks, read-only memories (ROMs), random access memories (RAMs), EPROMs, EEPROMs, magnetic or optical cards, or any type of media suitable for storing electronic instructions, and each coupled to a computer system bus.
The algorithms and displays presented herein are not inherently related to any particular computer or other apparatus. Various general purpose systems may be used with programs in accordance with the teachings herein, or it may prove convenient to construct more specialized apparatus to perform the required method steps. The required structure for a variety of these systems will appear from the description below. In addition, the present invention is not described with reference to any particular programming language. It will be appreciated that a variety of programming languages may be used to implement the teachings of the invention as described herein.
It is to be understood that the above description is intended to be illustrative, and not restrictive. Many other embodiments will be apparent to those of skill in the art upon reading and understanding the above description. The scope of the invention should, therefore, be determined with reference to the appended claims, along with the full scope of equivalents to which such claims are entitled.

Claims (20)

What is claimed is:
1. A method comprising:
identifying, by a processing device, a file format corresponding to a text file, wherein the file format comprises mapping instructions to map one or more entries of the text file into a tree structure;
parsing by the processing device, in view of the file format, the text file into the tree structure; and
bidirectionally updating, by the processing device, the text file and the tree structure, wherein modifications to the tree structure are reflected by corresponding updates to the text file, and wherein modifications to the text file are reflected by corresponding updates to the tree structure, and wherein original formatting details of the text file are preserved.
2. The method of claim 1 wherein the one or more entries of the text file are classified by the mapping instructions.
3. The method of claim 1 wherein the tree structure is modified in response to input to a command line tool.
4. The method of claim 1 wherein the text file is modified in response to input to a command line tool.
5. The method of claim 1 wherein a node of the tree structure comprises a sibling field, a label field, a value field, and a child field.
6. The method of claim 1 further comprising: synchronously mapping between the text file and the tree structure.
7. The method of claim 6 wherein the mapping comprises:
parsing the text file with a get function to produce the tree structure; and
transforming the tree structure back into the text file with a put and create function.
8. A non-transitory computer-readable storage medium comprising instructions to cause a processing device to:
identify, by the processing device, a file format corresponding to a text file, wherein the file format comprises mapping instructions to map one or more entries of the text file into a tree structure;
parse by the processing device, in view of the file format, the text file into the tree structure; and
bidirectionally update, by the processing device, the text file and the tree structure, wherein modifications to the tree structure are reflected by corresponding updates to the text file, and wherein modifications to the text file are reflected by corresponding updates to the tree structure, and wherein original formatting details of the text file are preserved.
9. The non-transitory computer-readable storage medium of claim 8 wherein the one or more entries of the text file are classified by the mapping instructions.
10. The non-transitory computer-readable storage medium of claim 8 wherein the tree structure is modified in response to input to a command line tool.
11. The non-transitory computer-readable storage medium of claim 8 wherein the text file is modified in response to input to a command line tool.
12. The non-transitory computer-readable storage medium of claim 8 wherein a node of the tree structure comprises a sibling field, a label field, a value field, and a child field.
13. The non-transitory computer-readable storage medium of claim 8 wherein the processing device further to:
synchronously map between the text file and the tree structure.
14. The non-transitory computer-readable storage medium of claim 13 wherein to synchronously map comprises the processing device to:
parse the text file with a get function to produce the tree structure; and
transform the tree structure back into the text file with a put and create function.
15. A system comprising:
a memory to store a text file and a library of file formats, wherein each file format in the library comprises mapping instructions on how each entry in the text file is to be mapped into a tree structure; and
a processing device operatively coupled to the memory, the processing device to:
identify a file format corresponding to the text file,
parse, in view of the file format, the text file into the tree structure, and
bidirectionally update the text file and the tree structure, wherein modifications to the tree structure are reflected by corresponding updates to the text file, and wherein modifications to the text file are reflected by corresponding updates to the tree structure, and wherein original formatting details of the text file are preserved.
16. The system of claim 15 wherein the processing device is also to:
synchronously map between the text file and a tree structure.
17. The system of claim 15 wherein the tree structure is modified in response to input to a command line tool.
18. The system of claim 15 wherein the one or more entries of the text file are classified by the mapping instructions.
19. The system of claim 15 wherein a node of the tree structure comprises a sibling field, a label field, a value field, and a child field.
20. The system of claim 15 wherein the processing device is to parse via a get function, and wherein the processing device is to update via a put and create function that transforms the tree structure back into the text file.
US12/394,008 2009-02-26 2009-02-26 Programmatic editing of text files Active 2033-08-05 US9298480B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US12/394,008 US9298480B2 (en) 2009-02-26 2009-02-26 Programmatic editing of text files

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
US12/394,008 US9298480B2 (en) 2009-02-26 2009-02-26 Programmatic editing of text files

Publications (2)

Publication Number Publication Date
US20100218200A1 US20100218200A1 (en) 2010-08-26
US9298480B2 true US9298480B2 (en) 2016-03-29

Family

ID=42632056

Family Applications (1)

Application Number Title Priority Date Filing Date
US12/394,008 Active 2033-08-05 US9298480B2 (en) 2009-02-26 2009-02-26 Programmatic editing of text files

Country Status (1)

Country Link
US (1) US9298480B2 (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8341652B2 (en) * 2009-02-26 2012-12-25 Red Hat, Inc. Method for programmatic editing of configuration files
US9411613B1 (en) 2015-04-22 2016-08-09 Ryft Systems, Inc. Systems and methods for managing execution of specialized processors
US9542244B2 (en) * 2015-04-22 2017-01-10 Ryft Systems, Inc. Systems and methods for performing primitive tasks using specialized processors
US9411528B1 (en) 2015-04-22 2016-08-09 Ryft Systems, Inc. Storage management systems and methods
CN112306576B (en) * 2020-11-03 2023-11-07 深圳市桑达无线通讯技术有限公司 Method for modifying built-in number of android device application program
CN115392160A (en) * 2022-06-10 2022-11-25 无锡芯光互连技术研究院有限公司 Format conversion method of circuit diagram description file

Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5745902A (en) * 1992-07-06 1998-04-28 Microsoft Corporation Method and system for accessing a file using file names having different file name formats
US6061513A (en) * 1997-08-18 2000-05-09 Scandura; Joseph M. Automated methods for constructing language specific systems for reverse engineering source code into abstract syntax trees with attributes in a form that can more easily be displayed, understood and/or modified
US20030028561A1 (en) * 1999-05-19 2003-02-06 Alexander G. Gounares Html/xml tree synchronization
US20030035547A1 (en) * 2001-03-27 2003-02-20 John Newton Server with multiple encryption libraries
US20040093342A1 (en) * 2001-06-27 2004-05-13 Ronald Arbo Universal data mapping system
US20040189713A1 (en) 2001-10-31 2004-09-30 Metacyber.Net Computer-based user interface for a memory-resident rapid comprehension document for original source information
US20060106841A1 (en) 2004-11-12 2006-05-18 Microsoft Corporation Computer file system
US20080082962A1 (en) * 2006-09-29 2008-04-03 Alexander Falk User interface for defining a text file transformation
US20080155397A1 (en) * 2006-12-21 2008-06-26 Microsoft Corporation Synchronizing data between different editor views
US7412649B2 (en) * 2005-01-24 2008-08-12 International Business Machines Corporation Viewing and editing markup language files with complex semantics
US20090063956A1 (en) * 2007-08-27 2009-03-05 International Business Machines Corporation Apparatus and system for an automated bidirectional format transform
US20090083619A1 (en) * 1999-05-21 2009-03-26 E-Numerate Solutions, Inc. Reusable data markup language
US20100218199A1 (en) 2009-02-26 2010-08-26 David Lutterkort Method for programmatic editing of configuration files

Patent Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5745902A (en) * 1992-07-06 1998-04-28 Microsoft Corporation Method and system for accessing a file using file names having different file name formats
US6061513A (en) * 1997-08-18 2000-05-09 Scandura; Joseph M. Automated methods for constructing language specific systems for reverse engineering source code into abstract syntax trees with attributes in a form that can more easily be displayed, understood and/or modified
US20030028561A1 (en) * 1999-05-19 2003-02-06 Alexander G. Gounares Html/xml tree synchronization
US20090083619A1 (en) * 1999-05-21 2009-03-26 E-Numerate Solutions, Inc. Reusable data markup language
US20030035547A1 (en) * 2001-03-27 2003-02-20 John Newton Server with multiple encryption libraries
US20040093342A1 (en) * 2001-06-27 2004-05-13 Ronald Arbo Universal data mapping system
US20040189713A1 (en) 2001-10-31 2004-09-30 Metacyber.Net Computer-based user interface for a memory-resident rapid comprehension document for original source information
US20060106841A1 (en) 2004-11-12 2006-05-18 Microsoft Corporation Computer file system
US7412649B2 (en) * 2005-01-24 2008-08-12 International Business Machines Corporation Viewing and editing markup language files with complex semantics
US20080082962A1 (en) * 2006-09-29 2008-04-03 Alexander Falk User interface for defining a text file transformation
US20080155397A1 (en) * 2006-12-21 2008-06-26 Microsoft Corporation Synchronizing data between different editor views
US20090063956A1 (en) * 2007-08-27 2009-03-05 International Business Machines Corporation Apparatus and system for an automated bidirectional format transform
US20100218199A1 (en) 2009-02-26 2010-08-26 David Lutterkort Method for programmatic editing of configuration files

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
USPTO; Notice of Allowance for U.S. Appl. No. 12/394,006, mailed Aug. 16, 2012.
USPTO; Office Action for U.S. Appl. No. 12/394,006, mailed Mar. 7, 2012.

Also Published As

Publication number Publication date
US20100218200A1 (en) 2010-08-26

Similar Documents

Publication Publication Date Title
US8819629B2 (en) Automatically generating documentation on application programming interfaces
US8799299B2 (en) Schema contracts for data integration
US9977770B2 (en) Conversion of a presentation to Darwin Information Typing Architecture (DITA)
US9298480B2 (en) Programmatic editing of text files
JP7206687B2 (en) API parameter mapping
US10062030B2 (en) Tree structured data transform, by determining whether a predicate of a rule matches a given node in a set and applying a function responsive to the match
US8341652B2 (en) Method for programmatic editing of configuration files
US8086618B2 (en) Configuration rule translation mapper
US11474796B1 (en) Build system for distributed applications
CN110554875B (en) Code conversion method and device, electronic equipment and storage medium
US20150178263A1 (en) System and Method for Constructing Markup Language Templates and Input Data Structure Specifications
US10191734B1 (en) Method and system for software application optimization using natural language-based queries
US20140032725A1 (en) Method and system for deploying a model-based application to an application server
CN110569488A (en) modular template WORD generation method based on XML (extensive markup language)
US20170371977A1 (en) Unbounded list processing
US7788246B2 (en) Linguistic structure for data flow diagrams
CN111142871B (en) Front-end page development system, method, equipment and medium
US20110296373A1 (en) Command line shell command generation based on schema
US10706215B2 (en) Producing formula representations of mathematical text
CN114611714B (en) Model processing method, device, system, electronic equipment and storage medium
US20050177788A1 (en) Text to XML transformer and method
US10949327B2 (en) Manipulation of complex variables in orchestration applications
US20180011833A1 (en) Syntax analyzing device, learning device, machine translation device and storage medium
US9990343B2 (en) System and method for in-browser editing
CN111078217A (en) Brain graph generation method, apparatus and computer-readable storage medium

Legal Events

Date Code Title Description
AS Assignment

Owner name: RED HAT, INC., NORTH CAROLINA

Free format text: ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNOR:LUTTERKORT, DAVID;REEL/FRAME:022319/0087

Effective date: 20090226

STCF Information on status: patent grant

Free format text: PATENTED CASE

MAFP Maintenance fee payment

Free format text: PAYMENT OF MAINTENANCE FEE, 4TH YEAR, LARGE ENTITY (ORIGINAL EVENT CODE: M1551); ENTITY STATUS OF PATENT OWNER: LARGE ENTITY

Year of fee payment: 4

FEPP Fee payment procedure

Free format text: 7.5 YR SURCHARGE - LATE PMT W/IN 6 MO, LARGE ENTITY (ORIGINAL EVENT CODE: M1555); ENTITY STATUS OF PATENT OWNER: LARGE ENTITY

MAFP Maintenance fee payment

Free format text: PAYMENT OF MAINTENANCE FEE, 8TH YEAR, LARGE ENTITY (ORIGINAL EVENT CODE: M1552); ENTITY STATUS OF PATENT OWNER: LARGE ENTITY

Year of fee payment: 8