GME  13
svn_opt.h
Go to the documentation of this file.
00001 
00027 #ifndef SVN_OPTS_H
00028 #define SVN_OPTS_H
00029 
00030 #include <apr.h>
00031 #include <apr_pools.h>
00032 #include <apr_getopt.h>
00033 #include <apr_tables.h>
00034 #include <apr_hash.h>
00035 
00036 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00037 #define APR_WANT_STDIO
00038 #endif
00039 #include <apr_want.h>   /* for FILE* */
00040 
00041 #include "svn_types.h"
00042 
00043 #ifdef __cplusplus
00044 extern "C" {
00045 #endif /* __cplusplus */
00046 
00047 
00048 
00062 typedef svn_error_t *(svn_opt_subcommand_t)(
00063   apr_getopt_t *os, void *baton, apr_pool_t *pool);
00064 
00065 
00067 #define SVN_OPT_MAX_ALIASES 3
00068 
00070 #define SVN_OPT_MAX_OPTIONS 50
00071 
00075 #define SVN_OPT_FIRST_LONGOPT_ID 256
00076 
00077 
00082 typedef struct svn_opt_subcommand_desc2_t
00083 {
00085   const char *name;
00086 
00088   svn_opt_subcommand_t *cmd_func;
00089 
00091   const char *aliases[SVN_OPT_MAX_ALIASES];
00092 
00094   const char *help;
00095 
00099   int valid_options[SVN_OPT_MAX_OPTIONS];
00100 
00105   struct { int optch; const char *desc; } desc_overrides[SVN_OPT_MAX_OPTIONS];
00106 } svn_opt_subcommand_desc2_t;
00107 
00108 
00116 typedef struct svn_opt_subcommand_desc_t
00117 {
00119   const char *name;
00120 
00122   svn_opt_subcommand_t *cmd_func;
00123 
00125   const char *aliases[SVN_OPT_MAX_ALIASES];
00126 
00128   const char *help;
00129 
00133   int valid_options[SVN_OPT_MAX_OPTIONS];
00134 
00135 } svn_opt_subcommand_desc_t;
00136 
00137 
00144 const svn_opt_subcommand_desc2_t *
00145 svn_opt_get_canonical_subcommand2(const svn_opt_subcommand_desc2_t *table,
00146                                   const char *cmd_name);
00147 
00148 
00158 SVN_DEPRECATED
00159 const svn_opt_subcommand_desc_t *
00160 svn_opt_get_canonical_subcommand(const svn_opt_subcommand_desc_t *table,
00161                                  const char *cmd_name);
00162 
00163 
00175 const apr_getopt_option_t *
00176 svn_opt_get_option_from_code2(int code,
00177                               const apr_getopt_option_t *option_table,
00178                               const svn_opt_subcommand_desc2_t *command,
00179                               apr_pool_t *pool);
00180 
00181 
00189 SVN_DEPRECATED
00190 const apr_getopt_option_t *
00191 svn_opt_get_option_from_code(int code,
00192                              const apr_getopt_option_t *option_table);
00193 
00194 
00203 svn_boolean_t
00204 svn_opt_subcommand_takes_option3(const svn_opt_subcommand_desc2_t *command,
00205                                  int option_code,
00206                                  const int *global_options);
00207 
00214 SVN_DEPRECATED
00215 svn_boolean_t
00216 svn_opt_subcommand_takes_option2(const svn_opt_subcommand_desc2_t *command,
00217                                  int option_code);
00218 
00219 
00229 SVN_DEPRECATED
00230 svn_boolean_t
00231 svn_opt_subcommand_takes_option(const svn_opt_subcommand_desc_t *command,
00232                                 int option_code);
00233 
00234 
00249 void
00250 svn_opt_print_generic_help2(const char *header,
00251                             const svn_opt_subcommand_desc2_t *cmd_table,
00252                             const apr_getopt_option_t *opt_table,
00253                             const char *footer,
00254                             apr_pool_t *pool,
00255                             FILE *stream);
00256 
00257 
00264 SVN_DEPRECATED
00265 void
00266 svn_opt_print_generic_help(const char *header,
00267                            const svn_opt_subcommand_desc_t *cmd_table,
00268                            const apr_getopt_option_t *opt_table,
00269                            const char *footer,
00270                            apr_pool_t *pool,
00271                            FILE *stream);
00272 
00273 
00279 void
00280 svn_opt_format_option(const char **string,
00281                       const apr_getopt_option_t *opt,
00282                       svn_boolean_t doc,
00283                       apr_pool_t *pool);
00284 
00285 
00286 
00302 void
00303 svn_opt_subcommand_help3(const char *subcommand,
00304                          const svn_opt_subcommand_desc2_t *table,
00305                          const apr_getopt_option_t *options_table,
00306                          const int *global_options,
00307                          apr_pool_t *pool);
00308 
00315 SVN_DEPRECATED
00316 void
00317 svn_opt_subcommand_help2(const char *subcommand,
00318                          const svn_opt_subcommand_desc2_t *table,
00319                          const apr_getopt_option_t *options_table,
00320                          apr_pool_t *pool);
00321 
00322 
00329 SVN_DEPRECATED
00330 void
00331 svn_opt_subcommand_help(const char *subcommand,
00332                         const svn_opt_subcommand_desc_t *table,
00333                         const apr_getopt_option_t *options_table,
00334                         apr_pool_t *pool);
00335 
00336 
00337 
00338 /* Parsing revision and date options. */
00339 
00349 enum svn_opt_revision_kind {
00351   svn_opt_revision_unspecified,
00352 
00354   svn_opt_revision_number,
00355 
00357   svn_opt_revision_date,
00358 
00360   svn_opt_revision_committed,
00361 
00363   svn_opt_revision_previous,
00364 
00366   svn_opt_revision_base,
00367 
00369   svn_opt_revision_working,
00370 
00372   svn_opt_revision_head
00373 
00374   /* please update svn_opt__revision_to_string() when extending this enum */
00375 };
00376 
00386 typedef union svn_opt_revision_value_t
00387 {
00389   svn_revnum_t number;
00390 
00392   apr_time_t date;
00393 } svn_opt_revision_value_t;
00394 
00396 typedef struct svn_opt_revision_t
00397 {
00398   enum svn_opt_revision_kind kind;  
00399   svn_opt_revision_value_t value;   
00400 } svn_opt_revision_t;
00401 
00403 typedef struct svn_opt_revision_range_t
00404 {
00406   svn_opt_revision_t start;
00407 
00409   svn_opt_revision_t end;
00410 } svn_opt_revision_range_t;
00411 
00433 int
00434 svn_opt_parse_revision(svn_opt_revision_t *start_revision,
00435                        svn_opt_revision_t *end_revision,
00436                        const char *arg,
00437                        apr_pool_t *pool);
00438 
00458 int
00459 svn_opt_parse_revision_to_range(apr_array_header_t *opt_ranges,
00460                                 const char *arg,
00461                                 apr_pool_t *pool);
00462 
00488 svn_error_t *
00489 svn_opt_resolve_revisions(svn_opt_revision_t *peg_rev,
00490                           svn_opt_revision_t *op_rev,
00491                           svn_boolean_t is_url,
00492                           svn_boolean_t notice_local_mods,
00493                           apr_pool_t *pool);
00494 
00495 
00496 /* Parsing arguments. */
00497 
00521 SVN_DEPRECATED
00522 svn_error_t *
00523 svn_opt_args_to_target_array3(apr_array_header_t **targets_p,
00524                               apr_getopt_t *os,
00525                               const apr_array_header_t *known_targets,
00526                               apr_pool_t *pool);
00527 
00537 SVN_DEPRECATED
00538 svn_error_t *
00539 svn_opt_args_to_target_array2(apr_array_header_t **targets_p,
00540                               apr_getopt_t *os,
00541                               const apr_array_header_t *known_targets,
00542                               apr_pool_t *pool);
00543 
00544 
00559 SVN_DEPRECATED
00560 svn_error_t *
00561 svn_opt_args_to_target_array(apr_array_header_t **targets_p,
00562                              apr_getopt_t *os,
00563                              const apr_array_header_t *known_targets,
00564                              svn_opt_revision_t *start_revision,
00565                              svn_opt_revision_t *end_revision,
00566                              svn_boolean_t extract_revisions,
00567                              apr_pool_t *pool);
00568 
00569 
00579 svn_error_t *
00580 svn_opt_parse_revprop(apr_hash_t **revprops, const char *revprop_spec,
00581                       apr_pool_t *pool);
00582 
00583 
00591 void
00592 svn_opt_push_implicit_dot_target(apr_array_header_t *targets,
00593                                  apr_pool_t *pool);
00594 
00595 
00601 svn_error_t *
00602 svn_opt_parse_num_args(apr_array_header_t **args_p,
00603                        apr_getopt_t *os,
00604                        int num_args,
00605                        apr_pool_t *pool);
00606 
00607 
00613 svn_error_t *
00614 svn_opt_parse_all_args(apr_array_header_t **args_p,
00615                        apr_getopt_t *os,
00616                        apr_pool_t *pool);
00617 
00660 svn_error_t *
00661 svn_opt_parse_path(svn_opt_revision_t *rev,
00662                    const char **truepath,
00663                    const char *path,
00664                    apr_pool_t *pool);
00665 
00702 svn_error_t *
00703 svn_opt_print_help4(apr_getopt_t *os,
00704                     const char *pgm_name,
00705                     svn_boolean_t print_version,
00706                     svn_boolean_t quiet,
00707                     svn_boolean_t verbose,
00708                     const char *version_footer,
00709                     const char *header,
00710                     const svn_opt_subcommand_desc2_t *cmd_table,
00711                     const apr_getopt_option_t *option_table,
00712                     const int *global_options,
00713                     const char *footer,
00714                     apr_pool_t *pool);
00715 
00722 SVN_DEPRECATED
00723 svn_error_t *
00724 svn_opt_print_help3(apr_getopt_t *os,
00725                     const char *pgm_name,
00726                     svn_boolean_t print_version,
00727                     svn_boolean_t quiet,
00728                     const char *version_footer,
00729                     const char *header,
00730                     const svn_opt_subcommand_desc2_t *cmd_table,
00731                     const apr_getopt_option_t *option_table,
00732                     const int *global_options,
00733                     const char *footer,
00734                     apr_pool_t *pool);
00735 
00743 SVN_DEPRECATED
00744 svn_error_t *
00745 svn_opt_print_help2(apr_getopt_t *os,
00746                     const char *pgm_name,
00747                     svn_boolean_t print_version,
00748                     svn_boolean_t quiet,
00749                     const char *version_footer,
00750                     const char *header,
00751                     const svn_opt_subcommand_desc2_t *cmd_table,
00752                     const apr_getopt_option_t *option_table,
00753                     const char *footer,
00754                     apr_pool_t *pool);
00755 
00756 
00762 SVN_DEPRECATED
00763 svn_error_t *
00764 svn_opt_print_help(apr_getopt_t *os,
00765                    const char *pgm_name,
00766                    svn_boolean_t print_version,
00767                    svn_boolean_t quiet,
00768                    const char *version_footer,
00769                    const char *header,
00770                    const svn_opt_subcommand_desc_t *cmd_table,
00771                    const apr_getopt_option_t *option_table,
00772                    const char *footer,
00773                    apr_pool_t *pool);
00774 
00775 #ifdef __cplusplus
00776 }
00777 #endif /* __cplusplus */
00778 
00779 #endif /* SVN_OPTS_H */