Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Saturday, October 17, 2026

Diff for libcfg+/src/cfg+.h between version 1.42 and 1.43

version 1.42, 2002/07/15 16:43:12 version 1.43, 2002/07/16 13:42:11
Line 5 
Line 5 
  * ____________________________________________________________   * ____________________________________________________________
  *   *
  * Developed by Ondrej Jombik <nepto@pobox.sk>   * Developed by Ondrej Jombik <nepto@pobox.sk>
  *          and Lubomir Host <rajo@host.sk>  *          and Lubomir Host <rajo@host.sk>
  * Copyright (c) 2001-2002 Platon SDG, http://www.platon.sk/   * Copyright (c) 2001-2002 Platon SDG, http://www.platon.sk/
  * All rights reserved.   * All rights reserved.
  *   *
Line 117  enum cfg_error {
Line 117  enum cfg_error {
  */   */
 /*@{*/  /*@{*/
 /**  /**
  * By default are @ref CFG_SKIP_FIRST, @ref CFG_POSIXLY_LEFTOVERS and   * By default are @ref CFG_PROCESS_FIRST, @ref CFG_POSIXLY_LEFTOVERS and
  * @ref CFG_NORMAL_LEFTOVERS initialized.   * @ref CFG_NORMAL_LEFTOVERS initialized.
  * @todo CFG_APPEND, CFG_OVERWRITE, CFG_APPEND_MULTI_ONLY   * @todo CFG_APPEND, CFG_OVERWRITE, CFG_APPEND_MULTI_ONLY
  */   */
Line 129  enum cfg_flag {
Line 129  enum cfg_flag {
         /** Ignore unknown options. */          /** Ignore unknown options. */
         CFG_IGNORE_UNKNOWN = 2,          CFG_IGNORE_UNKNOWN = 2,
   
         /** Skip processing of the first argument on command line. */  
         CFG_SKIP_FIRST = 0,  
   
         /** Process also the first argument on command line. */          /** Process also the first argument on command line. */
         CFG_PROCESS_FIRST = 4,          CFG_PROCESS_FIRST = 0,
   
           /** Skip processing of the first argument on command line. */
           CFG_SKIP_FIRST = 4,
   
         /** Posixly correct leftover arguments. */          /** Posixly correct leftover arguments. */
         CFG_POSIXLY_LEFTOVERS = 0,          CFG_POSIXLY_LEFTOVERS = 0,
Line 420  struct cfg_context {
Line 420  struct cfg_context {
         /** Context type (command line or config file) */          /** Context type (command line or config file) */
         enum cfg_context_type type;          enum cfg_context_type type;
   
         /** Possition range */  
         long begin_pos;  
         long end_pos;  
   
         /** Flags */          /** Flags */
         int flags;          int flags;
   
         /** Options table */          /** Options table */
         const struct cfg_option *options;          const struct cfg_option *options;
   
           /** Starting parsing position */
           long begin_pos;
   
           /** Number of elements (array arguments, bytes or lines) to parse
             (value of -1 means infinite) */
           long size;
   
         /** Array of used options indexes */          /** Array of used options indexes */
         int *used_opt_idx;          int *used_opt_idx;
   
Line 457  struct cfg_context {
Line 460  struct cfg_context {
          */           */
         /*@{*/          /*@{*/
   
         /* int argc; */          /** Flag to detect if parsing already started */
           int parsing_started:1;
   
           /** NULL terminated array of argument */
         char **argv;          char **argv;
   
         /*@}*/          /*@}*/
Line 467  struct cfg_context {
Line 473  struct cfg_context {
          */           */
         /*@{*/          /*@{*/
   
           /** Filename (name of file) */
         char *filename;          char *filename;
   
           /** Pointer to FILE* structure of parsed file */
         FILE *fhandle;          FILE *fhandle;
   
         /*@}*/          /*@}*/
Line 504  extern "C" {
Line 513  extern "C" {
          * Initialize command line context           * Initialize command line context
          *           *
          * @param begin_pos     index of beginning argument of arguments array           * @param begin_pos     index of beginning argument of arguments array
          * @param end_pos       index of ending argument of arguments array           * @param size          maximal number of array elements to parse
            *                                      (set value of -1 for infinite)
          * @param argv          arguments array           * @param argv          arguments array
          * @param options       pointer to options table           * @param options       pointer to options table
          * @return                      initialized command line context           * @return                      initialized command line context
          */           */
         CFG_CONTEXT cfg_get_cmdline_context(          CFG_CONTEXT cfg_get_cmdline_context(
                         long begin_pos,                          long begin_pos,
                         long end_pos,                          long size,
                         char **argv,                          char **argv,
                         struct cfg_option *options);                          struct cfg_option *options);
   
           /* this must be function */
   #if 0
 #define cfg_get_cmdline_context_by_argc(argc, argv, options) \  #define cfg_get_cmdline_context_by_argc(argc, argv, options) \
         cfg_get_cmdline_context(0, argc - 1, argv, options)          do { \
                   cfg_set_context_flag(
                   cfg_get_cmdline_context(0, argc - 1, argv, options) \
           } while (0)
   #endif
   
         /**                  /**
          * Initialize config line context                   * Initialize configuration file context
          *                   *
          * @param begin_pos     starting position in file to parse                   * @param begin_pos     starting position in file to parse
          * @param end_pos       ending position of file to parse                   * @param size          maximal number of bytes/lines in file to parse
          * @param filename      parsed filename                   *                                      (set value of -1 for infinite)
          * @param options       pointer to options table                   * @param filename      parsed filename
          * @return                      initialized command line context                   * @param options       pointer to options table
          */                   * @return                      initialized command line context
         CFG_CONTEXT cfg_get_cfgfile_context(                   */
                         long begin_pos,                  CFG_CONTEXT cfg_get_cfgfile_context(
                         long end_pos,                                  long begin_pos,
                         char *filename,                                  long size,
                         struct cfg_option *options);                                  char *filename,
                                   struct cfg_option *options);
   
         /**          /**
          * Set context to command line           * Set context to command line
          *           *
          * @param con           initialized context           * @param con           initialized context
          * @param begin_pos     index of beginning argument of arguments array           * @param begin_pos     index of beginning argument of arguments array
          * @param end_pos       index of ending argument of arguments array           * @param size          maximal number of array elements to parse
            *                                      (set value of -1 for infinite)
          * @param argv          arguments array           * @param argv          arguments array
          * @return                      void           * @return                      void
          */           */
         void cfg_set_cmdline_context(          void cfg_set_cmdline_context(
                         const CFG_CONTEXT con,                          const CFG_CONTEXT con,
                         long begin_pos,                          long begin_pos,
                         long end_pos,                          long size,
                         char **argv);                          char **argv);
   
 #define cfg_set_cmdline_context_by_argc(con, argc, argv) \  #define cfg_set_cmdline_context_by_argc(con, argc, argv) \
         cfg_set_cmdline_context(con, 0, argc - 1, argv)          cfg_set_cmdline_context(con, 0, argc - 1, argv)
   
         /**                  /**
          * Set context to command line                   * Set context to configuration file
          *                   *
          * @param con           initialized context                   * @param con           initialized context
          * @param begin_pos     starting position in file to parse                   * @param begin_pos     starting position in file to parse
          * @param end_pos       ending position of file to parse                   * @param size          maximal number of bytes/lines in file to parse
          * @param filename      parsed filename                   *                                      (set value of -1 for infinite)
          * @return                      void                   * @param filename      parsed filename
          */                   * @return                      void
         void cfg_set_cfgfile_context(                   */
                         const CFG_CONTEXT con,                  void cfg_set_cfgfile_context(
                         long begin_pos,                                  const CFG_CONTEXT con,
                         long end_pos,                                  long begin_pos,
                         char *filename);                                  long size,
                                   char *filename);
   
         /**          /**
          * Reinitialize popt context           * Reinitialize popt context

Legend:
Removed from v.1.42  
changed lines
  Added in v.1.43

Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top