Changes between Version 1 and Version 2 of Old/Documentation/OTG/FuncSpec/UserInterface


Ignore:
Timestamp:
Oct 6, 2005, 6:04:21 PM (19 years ago)
Author:
zhibinwu
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Old/Documentation/OTG/FuncSpec/UserInterface

    v1 v2  
    33= Function Specification: User Interface Design =
    44
    5 User Interace provides a command shell to users. User can specify important program arguments in a standard command line format. "--option <arg>".
     5User Interface provides a command shell to users. User can specify important program arguments in a standard command line format. "--option <arg>".
    66
    77== Design Requirement ==
    88The following principles of the design should be respected:
    9  * User only need to give command-line options once to start the program. A step-by-step configuraton tends to be confusing, error-prone and complicates fault-handling.
     9 * User only need to give command-line options once to start the program. A step-by-step configuration tends to be confusing, error-prone and complicates fault-handling.
    1010 * Configuration file shall not be used. (difficult to maintain)
    1111 * Run-time argument change must be supported whenever possible.
    12  * In the run-time, user comamnd inputs can only change one parameter a time. (multiple changes at the same time might lead mutual conflicting)
     12 * In the run-time, user command inputs can only change one parameter a time. (multiple changes at the same time might lead mutual conflicting)
    1313
    14 == Brief introduction abou using POPT ==
     14== Brief introduction about using POPT ==
    1515
    1616The OTG software uses POPT library to simplify the design of user interface. To use POPT,
     
    3131}}}
    3232
    33 then, use a while loop to parse all given option arguments. Whenever an option name matches one of the options defined in the options array, the "poptGetNextOpt" fucntion call will return a value. Different options return differnt valuse. This occurs repetitively until the value returns -1. So, In "case" of differnt value, different handling routing should be proceeded.
     33then, use a while loop to parse all given option arguments. Whenever an option name matches one of the options defined in the options array, the "poptGetNextOpt" function call will return a value. Different options return different values. This occurs repetitively until the value returns -1. So, In "case" of different value, different handling routing should be proceeded.
    3434{{{
    3535  int rc;
     
    6161In OTG program, first-tier options are following
    6262 * protocol, generator, debuglog
    63 "protocol" and "generator" must be parsed correctly before other arguements related to them can be understood. "debuglog" is used only for turning on the local logging of measurements. Because first-tier options are pivotal and governing 2nd-tier options in the program, run-time changes for them are impossible.
     63"protocol" and "generator" must be parsed correctly before other arguments related to them can be understood. "debuglog" is used only for turning on the local logging of measurements. Because first-tier options are pivotal and governing 2nd-tier options in the program, run-time changes for them are impossible.
    6464
    65 Correspondingly, three fucntions are used in parsing options:
     65Correspondingly, three functions are used in parsing options:
    6666 * parseOptionsPhase1
    6767 * parseOptionsPhase2
     
    6969
    7070''parseOptionsPhase1'' is used to set values for variables corresponding to first-tier arguments
    71 Because both Port and Generator are vitual base class, a certain type of Port and Generator objects will be created based on those variables.
     71Because both Port and Generator are virtual base class, a certain type of Port and Generator objects will be created based on those variables.
    7272Second-tier options are parsed by ''parseOptionsPhase2''. Certain properties of newly created Port and Generator objects will be set.
    7373Finally, ''parseRuntimeOptions'' will parse run-time user input to change a certain set of parameters.
    7474For initial shell user inputs, ''argc'' and ''argv'' are automatically provided by standard C. So, we pass them to POPT function directly.
    75 But for run-time user inputs, a special char* variable ''msg'' is taken as the parameter. The msg contain the setting for only one options and either in "--option <arg>" format or without leading hyphons.
     75But for run-time user inputs, a special char* variable ''msg'' is taken as the parameter. The msg contain the setting for only one options and either in "--option <arg>" format or without leading hyphens.
    7676
    7777== OTR User Interface ==
    7878In OTR program, first-tier options are following
    7979 * protocol, debuglog
    80 "protocol" must be parsed correctly before other arguements relating to receiving functions could be understood. "debuglog" is used only for turning on the local logging of measurements. Because first-tier options are pivotal and governing 2nd-tier options in the program, run-time changes for them are impossible.
     80"protocol" must be parsed correctly before other arguments relating to receiving functions could be understood. "debuglog" is used only for turning on the local logging of measurements. Because first-tier options are pivotal and governing 2nd-tier options in the program, run-time changes for them are impossible.
    8181
    82 Correspondingly, three fucntions are used in parsing options:
     82Correspondingly, three functions are used in parsing options:
    8383 * parseOptionsPhase1
    8484 * parseOptionsPhase2
     
    8686
    8787''parseOptionsPhase1'' is used to set values for variable corresponding to first-tier arguments
    88 Because Gate is a virtual base class, a certain type of Gate object will be created based on ''prootcol_name''  variable.
     88Because Gate is a virtual base class, a certain type of Gate object will be created based on ''protocol_name''  variable.
    8989Second-tier options are parsed by ''parseOptionsPhase2''. Certain properties of newly created Gate object will be set.
    9090Finally, ''parseRuntimeOptions'' will parse run-time user input to change a certain set of parameters.
     
    9494== Difference between OTG and OTR user interface design
    9595
    96 As can be seen, the deisng for OTG and OTR user interfaces are quite similar, but there are two major differnce:
     96As can be seen, the design for OTG and OTR user interfaces are quite similar, but there are two major difference:
    9797 * Gate does not need "generator" related options
    9898 * Gate does not support run-time pause and resume options.