The command line interface (sometimes also referred to as a command shell or simply a “shell”) is a common interface for computer operating systems (e.g., DOS, UNIX, etc.). A user enters commands on the command line one line after another and the operating system executes the commands in the order of entry. The operating system does not distinguish a command from a program. Commands and programs are run after the user has typed the name of the command or program and pressed the “Enter” key. The pressing of the “Enter” key signals to the system that the user has finished entering the text and it may begin running the command. For example, the user may type “Command0” in the command line interface and then press the “Enter” key. In this case, the pressing of the “Enter” key signals to the operating system that it should execute the “Command0” command.
In the case of the operating systems described above (e.g., DOS, UNIX), there is a standard set of commands included with the operating system. However, software developers may desire to add additional commands to this standard set while other software developers may be developing completely new operating systems which do not have any commands. These new operating systems may be, for example, for embedded devices (i.e., any device that may be networked with another electronic device). Examples of embedded devices include wireless telephones, PDAs, home appliances, office products, networking equipment, factory automation products, automotive components, security devices, etc. These operating system developers generally use a software development suite to build the new operating system including a command line interface and accompanying commands.
Despite the importance of the command line interface, it is often one of the most poorly engineered aspects of device architectures. Commands are often designed and implemented in a quick and dirty fashion merely to test a newly developed feature. This development scheme does not lend itself to an architecture that is both efficient at run-time and easy to modify and extend. Also, elements of the command line interface are often “hard coded” directly into the application. A lack of an abstract representation precludes utilization of modeling tools (e.g., GUIs) and other automated or semi-automated operations (e.g., a translation of natural language text, generation of a documentation, etc.)
The present invention is directed to a method for utilization of a command structure representation of data file/codes. In particular, the present invention relates to a method for generating a list of desired elements of a first software code, the first code having a predefined command structure; extracting the desired elements from the first code; and performing an operation on the extracted elements. In addition, the present invention relates to a system includes a first engine which receives a list of desired elements of a first software code, the first code having a predefined command structure; a second engine which extracts the desired elements from the first code; and a third engine which performs an operation on the extracted elements.
The present invention may be further understood with reference to the following description of preferred exemplary embodiments and the related appended drawings, wherein like elements are provided with the same reference numerals. Throughout this specification the terms command and command node may be used interchangeably. Additionally, the exemplary embodiments of the present invention will be discussed with reference to embedded devices and the accompanying operating systems. However, those skilled in the art will understand that the present invention is not limited to embedded systems, and may be used with any operating system that supports a Command Line Interface (“CLI”). Additionally, the term developer is generally used throughout this description to describe the individual responsible for developing the operating system (e.g., adding new commands, editing existing commands, etc.) The term user is generally used to describe the individual that may be using the operating system (e.g., entering commands in the CLI for the operating system to execute). However, the terms may be used interchangeably throughout this description. For example, the term user may also describe the individual responsible for developing the operating system.
Command nodes 10–60 may be stored in a database which may include information on a particular command node 10–60 such as a keyword or name, a help string, a prompt string, the access level, “no form” capabilities, the number of child nodes, pointers to the child nodes, a number of parameters associated with the command node, pointers to the parameter descriptions, the number of handler functions, pointers to the handler functions, etc. Thus, when a developer is defining a new command there may be a multitude of pieces of information the developer may include about the new command in order for that command to be properly inserted within the command structure. The exemplary embodiment of the present invention allows the developer to quickly create CLI commands by creating the structure of command nodes. Each command node may, in turn, be edited to add parameters and handler functions. The exemplary embodiment of the present invention also allows for the automatic generation of software code for the handler functions and provides for the modification of the generated code.
The current nodes field 406 of GUI 400 describes the family or command structure branch to which the new command node belongs. This field is not filled in by the developer, but is automatically filled in based on the location selected for the new command by the developer in step 310. For example, if GUI 400 of command node editor 120 were open for command0 node 210, current nodes field 406 would be empty because command0 node 210 is a child of root node 205. However, if GUI 400 of command node editor 120 were open for struct node 262, set node 260 would appear in current nodes field 406 indicating that struct node 262 is a child of set node 260.
When the above data is entered into the new command in step 320 via GUI 400, the process continues to step 330, where the parameters are entered for the new command. The entering of parameters is also accomplished via GUI 400 by adding the desired parameters to parameter field 410. Similarly to the addition of a new command, the parameters may be added via a GUI associated with parameter editor 140. GUI 400 is shown having no parameters in parameter field 410. However, a developer may add parameters to the new command by clicking on add button 411. Those of skill in the art will understand that a command node is not required to have a parameter. Thus, step 330 may be considered an optional step in that the developer may not elect to add any parameters to the new command. In such a case, parameter field 410 on GUI 400 will remain empty.
When the parameter is configured to the satisfaction of the developer, the OK button may be clicked taking the developer back to GUI 400 of command node editor 120. The newly added parameter will then be shown as a parameter for the new command node in parameter field 410 of GUI 400. Those of skill in the art will also understand that the parameters for a command node may be edited by pressing edit button 412 and may be deleted by pressing delete button 413. Edit button 412 may cause GUI 450 of parameter editor 140 to reappear, whereupon the developer may edit any of fields 451–461. It is also possible for the developer to add multiple parameters to the command node. For example, referring to GUI 200 in
Referring back to
The developer may select any of the parameters in available parameter field 502 by highlighting the desired parameter. The developer may then determine whether the parameter will be a required parameter or an optional parameter by pressing required button 504 or optional button 505, respectively. When the developer selects a parameter from available parameter field 502 and presses one of buttons 504 and 505, GUI 500 shows the selected parameter in handler parameter field 503. In the example of
When the handler function is configured to the satisfaction of the developer, the OK button may be clicked taking the developer back to GUI 400 of command node editor 120. The newly added handler function will then be shown as a handler function for the new command node in handler function field 420 of GUI 400. Those of skill in the art will also understand that the handler functions for a command node may be edited by pressing edit button 422 or deleted by pressing delete button 423. Edit button 422 may cause GUI 500 of handler editor 130 to reappear, whereupon the developer may edit any of fields 501–503. It is also possible for the developer to add multiple handler functions to the command node. In the case of multiple handler functions, the operating system may call the appropriate code for each of the handler functions when executing the command.
Referring back to
This code describes the root node (i.e., mRootCmdNode) and four child nodes (i.e., command0, command1, command2 and command3). As described above, each node may have information associated with the node that may be defined by the developer. Command structure generation engine 145 takes the information entered by the developer and generates the file that may be stored as the command structure. The exemplary code above may include the following information: keyword or name, help string, mode definition, access level, no form allowed, number of children, pointer to array of children, number of parameters, pointer to the array of parameters available to the node, number of handler functions attached to the node and a pointer to the array of handler functions. For example, root node mRootCmdNode is defined at the bottom of the code. The root node has no keyword or name (NULL), no help string (NULL), no mode definition (NULL), an access level of “0”, the no form is not allowed (FALSE), the number of children is “4”, the pointer to the array of children is “mRootChildren”, no associated parameters (0), no pointer to an array of parameters (NULL), no handler functions (0), and no pointer an array of handler functions (NULL).
The upper portion of the code describes the children of the root node. As described above, in this example, the root node has four children and a pointer to the array of command nodes mRootChildren. To carry through with the example, the code with respect to command3 will be described. This node has a name (command3), a help string variable (kCommand3Help), no mode definition (NULL), an access level of “0”, the no form is not allowed (FALSE), no children (0), no pointer to an array of children (NULL), two associated parameters (2), the pointer to the array of parameters is “mCommand3Params, one handler function (1), and the pointer to the array of handler functions is “mCommand3Handlers.” In the case of the help string variable the variable may be initialized in a portion of the code not shown to the string entered by the developer (e.g., #define kCommand3Help “\help string for command 3\”). Those of skill in the art will understand that the code for the remainder of the child commands is similar to that of command3.
The process then continues to step 360 where the handler function definitions and parameter definitions are generated by command structure generation engine 145. Similar to the command structure, command structure generation engine 145 takes the information input by the developer and generates a file containing the information for the handler functions and parameters. This file may be the same file as that generated for the command structure or a separate file may be generated. An exemplary file generated for the parameter definitions may be as follows:
This code describes an exemplary parameter definition array mCommand3Params for command3. As described above, command3 has two parameters and a pointer to the array mCommand3Params for the parameters. As described above, the developer may have entered information for each of these parameters in, for example, GUI 450. Command structure generation engine 145 takes the information entered by the developer and generates the parameter definition file. The exemplary code above may include the following information: keyword or name, data type (e.g., integer, boolean, etc.), a unique bitmask identifier, relative position to a given sequence of parameters, flags, and a pointer to a structure that may have more detailed information on the parameter. For example, referring to the exemplary line of code for param1, the name of the parameter is param1, the data type is kstring, the unique bitmask identifier is 0×00000001, its relative position is one compared to the other parameters (e.g., param2), there are no flags set (0) and there is no pointer to another structure (NULL). Those of skill in the art will understand that the code for param2 may be similar to that of param1.
An exemplary file generated for the handler function definitions may be as follows:
This code describes an exemplary handler function definition array mCommand3Handlers for command3. As described above, command3 has one handler function and a pointer to the array mCommand3Handlers for the one handler function. As described above, the developer may have entered information for the handler function in, for example, GUI 500. Command structure generation engine 145 takes the information entered by the developer and generates the handler function definition file. The exemplary code above may include the following information: the type of command (e.g., can this command handle “No” forms), the bitmask of required parameters, the bitmask of optional parameters and the actual handler function associated with the definition. For example, referring to the exemplary code for the command3 handler function, the command type is “0” meaning that it cannot handle the “No” form, the bitmask of param1 is identified as a required parameter (0×00000001), the bitmask of param2 is identified as an optional parameter (0×0000002) and the actual handler function is identified as VD_Command3Handler. The actual handler function will be described in greater detail below.
The process then continues to step 370 where the handler function code is generated by handler code generation engine 135. As described above, the handler function has associated software code associated therewith. Executing this software code causes the operating system to carry out the particular command typed by the user in the CLI. Handler code generation engine 135 automatically generates this software code using the information entered by the developer and the parameter and handler function definitions generated by command structure generation engine 145. The code generated by handler code generation engine 135 may be as follows:
Those skilled in the art will understand that this exemplary software code carries through with the example started above and may be exemplary code generated by handler code generation engine 135 for handler function VD_Command3Handler for command3. This function is given a pointer to a paramList structure which is a listing of all the parameters received by the command upon being called and paramDescr structure. Since both the paramList and paramDescr structures may change during the course of development, an abstract manner of getting the values associated with a parameter is provided. This manner is provided by the function RCC_DB_RetrieveParam function. To access the value in a given parameter using this function, all that is needed is the paramList that the handler receives, a set of parameter identifiers (e.g., keyword and/or bitmask identifier) and the address of a pointer to a paramDescr structure. If the RCC_DB_RetrieveParam function can find the parameter based on the keyword or bitmask identifier, then it initializes the parameter description to point to the relevant parameter within the parameter list. Referring to the portion of the code associated with the optional parameter (i.e., the portion of the code under the comment line “/* get optional parameter */”), the parameter is identified by both keyword (param2) and bitmask (0×00000002). If the optional parameter was entered in the CLI by the user, the parameter description (pParamDescr2) is initialized to point to the relevant parameter within the parameter list (pValue). The generated code for a required parameter (i.e., the portion of the code under the comment line “/* get required parameter */”) does not need to contain error checking to determine whether it received the parameter because the handler function would not be called unless the parameter was there. This code may be viewed as it is being generated in code view field 512 of GUI 500 as parameters are being added to the handler function.
Once the value has been set for a parameter, the handler function may use the value in any manner that the developer desires. For example, the developer may desire that the parameter value be displayed to the user. To carry out this function, the developer may add additional lines of code to the handler function. Handler code generation engine 135 provides for this by indicating in the generated code where the developer may insert additional code to accomplish functions desired by the developer. For example, the exemplary generated code described above includes a comment line “/* TO DO: Add your handler code here */” indicating where in the automatically generated code, a developer may enter additional code. This portion of code may be generated in response to the developers checking of enable button 511 of GUI 500. By checking enable button 511, the developer indicates that he may desire to add custom handler function code to the automatic code generated by handler code generation engine 135. When the developer desires to add this custom code to the handler function, he may press edit handler button 513 and a new GUI containing the code may appear on the display on which the developer may edit the automatically generated code.
Those skilled in the art will understand that it may also be possible to include additional information on the GUI screens so that additional handler code may be generated automatically. For example, on GUI 450 of parameter editor 140, it may be possible to include a field for the developer to input information as to whether the parameter value should be displayed to the user if the command is invoked. If such a field is included, the handler function code automatically generated by handler code generation engine 135 will include the lines of code to display the parameter value. The developer would not have to add more code to accomplish this function because it would be generated automatically.
Automatic code generation saves the developer time in implementing new commands and results in a more modular form of the software code for the operating system. For example, multiple developers may be implementing various command sets into an operating system. By using the automatic code generation feature, these developers will not need to type in as many lines of code by hand for the handler functions. In the process of setting up the commands, the handler functions and the parameters through the visual tools (e.g., the GUIs) provided by command node editor 120, handler editor 130 and parameter editor 140, respectively, the developers are also entering all the required information to automatically generate the handler function code. Thus, the setting of commands, handler functions and parameters and the generation of the handler function code is coordinated. Additionally, since handler code generation engine 135 generates code automatically, each developer will be utilizing the same code to accomplish the same functions within different commands. Therefore, when a developer looks at the code for different commands, the structure of the code and common functions will be exactly the same, allowing for easy troubleshooting and transportability of the code.
When a new command is entered by the developer, command structure generation engine 145 will add additional code to the command structure to incorporate the information added by the developer using the visual tools (e.g., the GUIs) provided by functions 110–140. Additionally, handler code generation engine 135 uses the information added by the developer and the information generated by command structure generation engine 145 to automatically build the handler function code. After the process of
Referring back to
GUI 200 may also be used to edit command nodes and the location of command nodes in the command structure. For example, if the developer desires to edit command0 node 210, the developer may highlight command0 node 210 and press edit button 203. This may cause GUI 400 of command node editor 120 to appear to the developer so that it may be edited by the developer. Similar to the creating of a command node, GUI 400 allows any of the fields to be edited, including the addition, deletion and editing of parameters and handler functions. When the edits are completed, the developer may press apply button 442 of GUI 400 and the edits are saved for the command node. When a command node is edited, command structure generation engine 145 and handler code generation engine 135 may also be invoked to edit the command structure, the handler function definitions, the parameter definitions and the handler function code based on the changes made to the command node, parameters and handler functions by the developer. As described above, the command structure, the handler function definitions, the parameter definitions and the handler function code is automatically generated based on the information provided by the developer and therefore may need to be revised based on any changed or additional information provided by the developer. For example, referring to
In the case of editing the location of a command node, GUI 200 may be used to drag and drop a command node from location to another. For example, it may be possible to highlight command0 node 210 and drag it so that it becomes a child of command2 node 230. In this case, GUI 400 may appear to the developer because some of the fields may have to be edited due to the change of location of the command node. Similarly, the developer may copy a command node by highlighting the particular command node and pressing a copy button available to the developer. The developer may then paste the contents of the copied command node to a new node in a location selected on GUI 200. This would copy the contents of an entire node to a new node which the developer may then edit.
Insert command node field 570 has a listing of information that may be included in the command node. This information is similar to the information shown in GUI 400 of
Insert parameter field 580 operates in a similar manner to insert command node field 570. The developer may highlight the information to be added and then add the information in one of text fields 581 and 584. Pressing add button 582 saves the information for the parameter. Those skilled in the art will understand that one or both of text fields 581 and 584 may also convert into a pull down menu when the type of information to be added is a limited set of data. For example, when adding the parameter type (e.g., Type (TP=)), the type of data to be added may be limited to particular types of parameters (e.g., unsigned long, integer, string, boolean, etc.). Therefore, text field 581 may convert to a pull down menu listing these types of parameters and the developer may select the parameter type from the pull down menu. Insert parameter field 580 may also have name field 583 which indicates the name of the parameter currently being added. Since a command node may have multiple parameters, the developer may desire to see the name of the parameter on which work is currently being performed. Similarly, insert parameter field 580 may also have unnamed field 585 to indicate the number of the unnamed parameter on which work is currently being performed.
Insert handler field 590 also operates in a similar manner to insert command node field 570. The developer may highlight the information to be added and then add the information in text field 591. Pressing add button 592 saves the information for the handler function. When the developer highlights the required or optional parameter information box, text field 591 may convert to a pull down menu with the available parameters. The developer may then select the desired parameter from this list of available parameters from the pull down menu in text field 591.
When all the desired information for the new command node is complete, the developer may press the submit button and the information will be saved and the automatic files will be generated (e.g., command structure, handler function definition, parameter definition, handler function code) for the new command node which will be inserted into command structure manifest 110. GUI 550 may be considered to include all the functionality of GUI 400, GUI 450 and GUI 500. GUI 550 may also be used to edit command nodes, parameters and handler functions.
Those skilled in the art will understand that such command data structure representation allows a number of high level actions/operations to be performed upon the data file/codes. These operations may be, for example, automatically carried out synchronous to the update and/or code generation, thus easing the burden of keeping all data correct and current. For example, the present invention may be utilized for generating a documentation manual or for translating commands into a foreign language. FIG. 15 shows an exemplary embodiment of a method for utilizing the command structure representation. In step 710, the command data structure may be generated according to the exemplary method described above and shown in
In step 712, shown in
In an alternative exemplary embodiment of the present invention, the list of predetermined elements may be generated by a program or subroutine. For example, a particular program may periodically need to examine certain parameters of the command node 705 in order to update it. Thus, this program may generate the predetermined list of the desired elements which will be extracted from the command node 705. Utilization of the data structure representation provides an efficient way for indication and extraction of the desired elements.
If the element is not included on the predetermined list of desired elements, then the command node 705 is examined to determine if it has another element (step 718). If such element exists, then steps 712 though 718 are repeated. A user may specify an order of extraction of the elements. For example, elements may be extracted from the top to the bottom of command node 705, or vice versa.
On the other hand, if the element is included in the predetermined list, then a set of predefined actions is performed upon the extracted desired element (step 716). For instance, the set of predetermined actions may include collection of all relevant help information and generation of a help manual. In addition, the set of predefined actions may be executed simultaneously with extraction of the desired element or after all of the desired elements are extracted.
The predefined actions may generate an output file in a human readable format.
Another way to utilize the command structure representation is to extracted certain elements in order to translate them into a foreign language and then insert them back into the same command structure. Alternatively, the command structure may be utilized to extract elements that need to be periodically updated; these elements are then updated and inserted back into the same command structure. Those skilled in the art will understand that one of the advantages of the command data structure representation is that it allows command line elements and trees to be easily imported and shared with other projects, thus providing consistent functionality with the development of common libraries.
One of the advantages of the present invention is that the formatted command structure representation may have a format for the structured data such that new data fields may be added and old ones removed, and yet, the data as a whole is still readable by older programs from any computing platform. The formatted data file is also structured such that rules for formatting the data are included or implied so that the data can be validated (e.g., XML).
Another advantage of the present invention is that the command structure representation of the data file (e.g., as one shown in
In the preceding specification, the present invention has been described with reference to specific exemplary embodiments thereof. It will, however, be evident that various modifications and changes may be made hereunto without departing from the broadest spirit and scope of the present invention as set forth in the claims that follow. The specification and drawings are accordingly to be regarded in an illustrative rather than restrictive sense.
This application is a continuation-in-part of U.S. patent application Ser. No. 09/797,106, entitled “System and Method for a Command Structure Representation” filed on Mar. 1, 2001, naming inventors Lee Chang and Shawn-Lin Dzeng. In addition, this application is a continuation-in-part of U.S. patent application Ser. No. 09/797,122, entitled “System and Method for Automatic Software Code Generation”, filed on Mar. 1, 2001 and naming inventors Lee Chang and Shawn-Lin Dzeng. Both of these filed U.S. patent applications are assigned to the Assignee of the present application and expressly incorporated herein, in their entirety, by reference. Furthermore, the benefit of the filing date of the above-referenced prior applications under 35 U.S.C. §120 is claimed.
Number | Name | Date | Kind |
---|---|---|---|
4613946 | Forman | Sep 1986 | A |
4821211 | Torres | Apr 1989 | A |
5262761 | Scandura et al. | Nov 1993 | A |
5448740 | Kiri et al. | Sep 1995 | A |
5546522 | Nishida et al. | Aug 1996 | A |
5600778 | Swanson et al. | Feb 1997 | A |
5600789 | Parker et al. | Feb 1997 | A |
5644736 | Healy et al. | Jul 1997 | A |
5649100 | Ertel et al. | Jul 1997 | A |
5652876 | Ashe et al. | Jul 1997 | A |
5715463 | Merkin | Feb 1998 | A |
5742762 | Scholl et al. | Apr 1998 | A |
5754939 | Herz et al. | May 1998 | A |
5815703 | Copeland et al. | Sep 1998 | A |
5857093 | Bradford | Jan 1999 | A |
5860010 | Attal | Jan 1999 | A |
5864865 | Lakis | Jan 1999 | A |
5870545 | Davis et al. | Feb 1999 | A |
5901286 | Danknick et al. | May 1999 | A |
5909550 | Shankar et al. | Jun 1999 | A |
5913052 | Beatty et al. | Jun 1999 | A |
5931917 | Nguyen et al. | Aug 1999 | A |
5966536 | Ravichandran | Oct 1999 | A |
5977967 | Berner et al. | Nov 1999 | A |
5987513 | Prithviraj et al. | Nov 1999 | A |
5996010 | Leong et al. | Nov 1999 | A |
5999948 | Nelson et al. | Dec 1999 | A |
6002867 | Jazdzewski | Dec 1999 | A |
6003077 | Bawden et al. | Dec 1999 | A |
6009274 | Fletcher et al. | Dec 1999 | A |
6028602 | Weidenfeller et al. | Feb 2000 | A |
6029195 | Herz | Feb 2000 | A |
6044218 | Faustini | Mar 2000 | A |
6049819 | Buckle et al. | Apr 2000 | A |
6054983 | Simonoff et al. | Apr 2000 | A |
6141792 | Acker et al. | Oct 2000 | A |
6182275 | Beelitz et al. | Jan 2001 | B1 |
6493868 | DaSilva et al. | Dec 2002 | B1 |
6587995 | Duboc et al. | Jul 2003 | B1 |
6605770 | Yamane et al. | Aug 2003 | B2 |
20010037412 | Miloushev et al. | Nov 2001 | A1 |
20010054008 | Miller et al. | Dec 2001 | A1 |
20020099530 | Foltinek | Jul 2002 | A1 |
20020178434 | Fox et al. | Nov 2002 | A1 |
20030092434 | Irisawa | May 2003 | A1 |
Number | Date | Country | |
---|---|---|---|
20030033589 A1 | Feb 2003 | US |
Number | Date | Country | |
---|---|---|---|
Parent | 09797106 | Mar 2001 | US |
Child | 09845414 | US | |
Parent | 09797122 | Mar 2001 | US |
Child | 09797106 | US |