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

Diff for libcfg+/src/cfg+.h between version 1.15 and 1.16

version 1.15, 2001/12/10 21:01:48 version 1.16, 2001/12/16 20:44:37
Line 1 
Line 1 
 #ifndef _PLATON_CFG_H  #ifndef _PLATON_CFG_H
 #define _PLATON_CFG_H  #define _PLATON_CFG_H
   
   #include <stdio.h>
   
 #include "props.h"  #include "props.h"
   
 #define CFG_END_OPTION { NULL, '\0', NULL, CFG_END, NULL, 0 }  #define CFG_END_OPTION { NULL, '\0', NULL, CFG_END, NULL, 0 }
Line 86  enum cfg_flag {
Line 88  enum cfg_flag {
         CFG_SKIP_FIRST = 0,          CFG_SKIP_FIRST = 0,
         CFG_PROCESS_FIRST = 4,          CFG_PROCESS_FIRST = 4,
   
           /* Posixly corect or not leftover arguments. */
           CFG_POSIXLY_LEFTOVERS = 0,
           CFG_ADVANCED_LEFTOVERS = 8,
   
         /* Ignore all quotations in options arguments. */          /* Ignore all quotations in options arguments. */
         CFG_USE_QUOTE = 0,          CFG_USE_QUOTE = 0,
         CFG_IGNORE_QUOTE = 8,          CFG_IGNORE_QUOTE = 16
   
         /* Posixly corect or not leftover arguments. */                  /* Advanced quotations are things like  option = va"'l'"ue
         CFG_POSIXLY_LEFTOVERS = 0,                     which resolves to                                    va'l'ue.
         CFG_ADVANCED_LEFTOVERS = 16,  
         CFG_EXTENDED_LEFTOVERS = 16,  
   
         /* TODO:                     We really want this strange stuff? Any volunter?
            CFG_APPEND,  
            CFG_OVERWRITE,                     CFG_ADVANCED_QUOTE = 32 + 16
            CFG_APPEND_MULTI_ONLY                   */
          */  
                   /* TODO:
                      CFG_APPEND,
                      CFG_OVERWRITE,
                      CFG_APPEND_MULTI_ONLY
                    */
 };  };
   
 enum cfg_option_type {  enum cfg_option_type {
Line 219  struct cfg_context {
Line 228  struct cfg_context {
         /* Options table. */          /* Options table. */
         const struct cfg_option *options;          const struct cfg_option *options;
   
           /* Quote prefix & postfix. */
           char **quote_prefix;
           char **quote_postfix;
   
         /*          /*
          * Command line specific properties.           * Command line specific properties.
          */           */
Line 237  struct cfg_context {
Line 250  struct cfg_context {
         /* Array of strings which forces to stop command line parsing. */          /* Array of strings which forces to stop command line parsing. */
         char **line_stop_str;          char **line_stop_str;
   
         /* Multi values separator. */  
         char **multi_vals_separator;  
   
         /* Prefixes and option argument separator. */          /* Prefixes and option argument separator. */
         char **short_option_prefix; /* default: "-" */          char **short_option_prefix; /* default: "-" */
         char **long_option_prefix; /* default: "--" */          char **long_option_prefix; /* default: "--" */
         char **line_option_arg_separator; /* default: "=" */          char **line_option_arg_separator; /* default: "=" */
   
           /* Multi values separator. */
           char **line_multi_vals_separator;
   
         /*          /*
          * Config file specific properties.           * Config file specific properties.
          */           */
Line 266  struct cfg_context {
Line 279  struct cfg_context {
   
         /* Option argument separator. */          /* Option argument separator. */
         char **file_option_arg_separator; /* default: "=" */          char **file_option_arg_separator; /* default: "=" */
   
           /* Multi values separator. */
           char **file_multi_vals_separator;
 };  };
   
 typedef struct cfg_context* CFG_CONTEXT;  typedef struct cfg_context* CFG_CONTEXT;
Line 312  extern "C" {
Line 328  extern "C" {
         void cfg_set_context_flags(const CFG_CONTEXT con, int flags);          void cfg_set_context_flags(const CFG_CONTEXT con, int flags);
         int cfg_get_context_flags(const CFG_CONTEXT con, int flags);          int cfg_get_context_flags(const CFG_CONTEXT con, int flags);
   
           void cfg_clear_multi_vals_separator(const CFG_CONTEXT con);
           int cfg_add_multi_vals_separator(const CFG_CONTEXT con, char *str);
           int cfg_remove_multi_vals_separator(const CFG_CONTEXT con, char *str);
   
           void cfg_clear_option_arg_separator(const CFG_CONTEXT con);
           int cfg_add_option_arg_separator(const CFG_CONTEXT con, char *str);
           int cfg_remove_option_arg_separator(const CFG_CONTEXT con, char *str);
   
           void cfg_clear_quote_strings(const CFG_CONTEXT con);
           int cfg_add_quote_strings(const CFG_CONTEXT con,
                           char *prefix, char *postfix);
           int cfg_remove_quote_strings(const CFG_CONTEXT con,
                           char *prefix, char *postfix);
   
 #define cfg_is_context_flag(con, flag) cfg_get_context_flag(con, flag)  #define cfg_is_context_flag(con, flag) cfg_get_context_flag(con, flag)
   
 #define cfg_clear_cmdline_stop_str(con) \  #define cfg_clear_cmdline_stop_string(con) \
         __cfg_clear_strdyn_array(&con->line_stop_str)          __cfg_clear_strdyn_array(&con->line_stop_str)
 #define cfg_add_cmdline_stop_str(con, str) \  #define cfg_add_cmdline_stop_string(con, str) \
                 __cfg_add_strdyn_array(&con->line_stop_str, str)                  __cfg_add_strdyn_array(&con->line_stop_str, str)
 #define cfg_remove_cmdline_stop_str(con, str) \  #define cfg_remove_cmdline_stop_string(con, str) \
                 __cfg_remove_strdyn_array(&con->line_stop_str, str)                  __cfg_remove_strdyn_array(&con->line_stop_str, str)
   
 #define cfg_clear_cfgfile_stop_prefix(con) \  #define cfg_clear_cfgfile_stop_prefix(con) \
Line 349  extern "C" {
Line 379  extern "C" {
 #define cfg_remove_cmdline_long_option_prefix(con, str) \  #define cfg_remove_cmdline_long_option_prefix(con, str) \
                 __cfg_remove_strdyn_array(&con->long_option_prefix, str)                  __cfg_remove_strdyn_array(&con->long_option_prefix, str)
   
 #define cfg_clear_cmdline_multi_vals_separator(con) \  
                 __cfg_clear_strdyn_array(&con->multi_vals_separator)  
 #define cfg_add_cmdline_multi_vals_separator(con, str) \  
                 __cfg_add_strdyn_array(&con->multi_vals_separator, str)  
 #define cfg_remove_cmdline_multi_vals_separator(con, str) \  
                 __cfg_remove_strdyn_array(&con->multi_vals_separator, str)  
   
 #define cfg_clear_cfgfile_multi_line_postfix(con) \  #define cfg_clear_cfgfile_multi_line_postfix(con) \
                 __cfg_clear_strdyn_array(&con->multi_line_postfix)                  __cfg_clear_strdyn_array(&con->multi_line_postfix)
 #define cfg_add_cfgfile_multi_line_postfix(con, str) \  #define cfg_add_cfgfile_multi_line_postfix(con, str) \
Line 363  extern "C" {
Line 386  extern "C" {
 #define cfg_remove_cfgfile_multi_line_postfix(con, str) \  #define cfg_remove_cfgfile_multi_line_postfix(con, str) \
                 __cfg_remove_strdyn_array(&con->multi_line_postfix, str)                  __cfg_remove_strdyn_array(&con->multi_line_postfix, str)
   
   #define cfg_clear_cmdline_multi_vals_separator(con) \
                   __cfg_clear_strdyn_array(&con->line_multi_vals_separator)
   #define cfg_add_cmdline_multi_vals_separator(con, str) \
                   __cfg_add_strdyn_array(&con->line_multi_vals_separator, str)
   #define cfg_remove_cmdline_multi_vals_separator(con, str) \
                   __cfg_remove_strdyn_array(&con->line_multi_vals_separator, str)
   
   #define cfg_clear_cfgfile_multi_vals_separator(con) \
                   __cfg_clear_strdyn_array(&con->file_multi_vals_separator)
   #define cfg_add_cfgfile_multi_vals_separator(con, str) \
                   __cfg_add_strdyn_array(&con->file_multi_vals_separator, str)
   #define cfg_remove_cfgfile_multi_vals_separator(con, str) \
                   __cfg_remove_strdyn_array(&con->file_multi_vals_separator, str)
   
 #define cfg_clear_cmdline_option_arg_separator(con) \  #define cfg_clear_cmdline_option_arg_separator(con) \
                 __cfg_clear_strdyn_array(&con->line_option_arg_separator)                  __cfg_clear_strdyn_array(&con->line_option_arg_separator)
 #define cfg_add_cmdline_option_arg_separator(con, str) \  #define cfg_add_cmdline_option_arg_separator(con, str) \
Line 374  extern "C" {
Line 411  extern "C" {
                 __cfg_clear_strdyn_array(&con->file_option_arg_separator)                  __cfg_clear_strdyn_array(&con->file_option_arg_separator)
 #define cfg_add_cfgfile_option_arg_separator(con, str) \  #define cfg_add_cfgfile_option_arg_separator(con, str) \
                 __cfg_add_strdyn_array(&con->file_option_arg_separator, str)                  __cfg_add_strdyn_array(&con->file_option_arg_separator, str)
 #define cfg_remove_cfgfile_option_arg_seaprator(con, str) \  #define cfg_remove_cfgfile_option_arg_separator(con, str) \
                 __cfg_remove_strdyn_array(&con->file_option_arg_separator, str)                  __cfg_remove_strdyn_array(&con->file_option_arg_separator, str)
   
                 /* Processing context options. */                  /* Processing context options. */
   
                 int cfg_parse(const CFG_CONTEXT con);                  int cfg_parse(const CFG_CONTEXT con);
         int cfg_get_next_opt(const CFG_CONTEXT con);          int cfg_get_next_opt(const CFG_CONTEXT con);
         int cfg_get_opt_arg(const CFG_CONTEXT con);          char *cfg_get_opt_arg(const CFG_CONTEXT con);
         char *cfg_get_cur_opt(const CFG_CONTEXT con);          char *cfg_get_cur_opt(const CFG_CONTEXT con);
         char *cfg_get_cur_arg(const CFG_CONTEXT con);          char *cfg_get_cur_arg(const CFG_CONTEXT con);
         int cfg_get_cur_idx(const CFG_CONTEXT con);          int cfg_get_cur_idx(const CFG_CONTEXT con);

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

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