Ver código fonte

script and Daemon Options updates

Evgeny Grin (Karlson2k) 1 ano atrás
pai
commit
77ff41b306

+ 1 - 0
.gitattributes

@@ -7,3 +7,4 @@ makefile.am	eol=lf
 *.crt	eol=lf
 *.pem	eol=lf
 *.rec	eol=lf
+*.template	eol=lf

+ 6 - 4
scripts/d_options.rec

@@ -17,10 +17,12 @@
 
 # MHD behaviour
 
-Name: work_mode
+Name: WORK_MODE
 Value: 40
-Comment: Set MHD threading and polling mode
+Comment: Set MHD work (threading and polling) mode.
++ Consider use of #MHD_DAEMON_OPTION_WM_EXTERNAL_PERIODIC(), #MHD_DAEMON_OPTION_WM_EXTERNAL_EVENT_LOOP_CB_LEVEL(), #MHD_DAEMON_OPTION_WM_EXTERNAL_EVENT_LOOP_CB_EDGE(), #MHD_DAEMON_OPTION_WM_EXTERNAL_SINGLE_FD_WATCH(), #MHD_DAEMON_OPTION_WORKER_THREADS() or #MHD_DAEMON_OPTION_THREAD_PER_CONNECTION() instead of direct use of this parameter.
 Argument1: struct MHD_WorkModeWithParam wmp
+Description1: the object created by one of the next functions/macros: #MHD_WM_OPTION_EXTERNAL_PERIODIC(), #MHD_WM_OPTION_EXTERNAL_EVENT_LOOP_CB_LEVEL(), #MHD_WM_OPTION_EXTERNAL_EVENT_LOOP_CB_EDGE(), #MHD_WM_OPTION_EXTERNAL_SINGLE_FD_WATCH(), #MHD_WM_OPTION_WORKER_THREADS(), #MHD_WM_OPTION_THREAD_PER_CONNECTION()
 
 Name: poll_syscall
 Value: 41
@@ -92,7 +94,7 @@ Name: sigpipe suppressed
 Value: 103
 Type: enum MHD_Bool
 Comment: Inform that SIGPIPE is suppressed or handled by application.
-+ If suppressed, allows MHD to use network functions that could generate SIGPIPE, like `sendfile()`.
++ If suppressed/handled, MHD uses network functions that could generate SIGPIPE, like `sendfile()`.
 + Silently ignored when MHD creates internal threads as for them SIGPIPE is suppressed automatically.
 
 # TLS settings
@@ -120,7 +122,7 @@ Comment: Controls ALPN for TLS connection.
 + Silently ignored for non-TLS.
 + By default ALPN is automatically used for TLS connections.
 
-# Connection processing
+# Connection handling
 
 Name: DEFAULT_TIMEOUT
 Value: 160

+ 10 - 9
scripts/d_options.sh

@@ -208,11 +208,11 @@ do
     fi
     TYPE=$(recsel -t MHD_Option -P Type -e "Value = $N" "$input_rec")
     EComment="" # The initial part of doxy comment for the enum value
-    EName=""    # The final part of the name of the enum value
-    UName=""    # The final part of the name of the union member
+    EName=""    # The name of the enum value
+    UName=""    # The name of the union member
     UType=""    # The type of the union member
     SComment="" # The doxy comment for the set macro/function
-    SName=""    # The final part of the name of the set macro/function
+    SName=""    # The name of the set macro/function
     MArguments=""   # The arguments for the macro
     CLBody=""   # The Compound Literal body (for the set macro)
     SFArguments=""  # The arguments for the static function
@@ -225,11 +225,12 @@ do
     clean_name="${clean_name,,}" # Lowercase space-delimited
 
     EName="${clean_name^^}"
-    EName="${EName// /_}" # Uppercase '_'-joined
+    EName="MHD_D_O_${EName// /_}" # Uppercase '_'-joined
     
-    UName="${clean_name// /_}" # lowercase '_'-joined
+    UName="v_${clean_name// /_}" # lowercase '_'-joined
     
-    SName="${EName}" # Uppercase '_'-joined
+    SName="${clean_name^^}"
+    SName="MHD_DAEMON_OPTION_${SName// /_}" # Uppercase '_'-joined
     
     format_doxy '   * ' "$COMMENT" || err_exit
     EComment="$format_doxy_res"
@@ -330,7 +331,7 @@ do
         fi
         
         [[ "$arg_type" =~ \*$ ]] || arg_type+=' ' # Position '*' correctly
-        [[ "$arg_name" = "v_${UName}" ]] && err_exit "The name ('$arg_name') of the argument 'Argument${M}' ('${ARGS[$M]}') for '$NAME' ('Value=$N') conflicts with the union member name ('v_${UName}'). Macro would not work."
+        [[ "$arg_name" = "${UName}" ]] && err_exit "The name ('$arg_name') of the argument 'Argument${M}' ('${ARGS[$M]}') for '$NAME' ('Value=$N') conflicts with the union member name ('${UName}'). Macro would not work."
         [[ "$arg_name" = "opt" ]] && err_exit "The name ('$arg_name') of the argument 'Argument${M}' ('${ARGS[$M]}') for '$NAME' ('Value=$N') conflicts with the option struct member name ('opt'). Macro would not work."
         [[ "$arg_name" = "val" ]] && err_exit "The name ('$arg_name') of the argument 'Argument${M}' ('${ARGS[$M]}') for '$NAME' ('Value=$N') conflicts with the option struct member name ('val'). Macro would not work."
         [[ "${arg_name,,}" = "${arg_name}" ]] || err_exit "The name ('$arg_name') of the argument 'Argument${M}' ('${ARGS[$M]}') for '$NAME' ('Value=$N') has capital letter(s)"
@@ -355,12 +356,12 @@ do
         
         #[[ $M -gt 1 ]] && CLBody+=', \'$'\n'"    "
         [[ $M -gt 1 ]] && CLBody+=', \##removeme##'$'\n'"    " # '##removeme##' is a workaround for requtils bug
-        CLBody+=".val.v_${UName}"
+        CLBody+=".val.${UName}"
         [[ $nested = 'yes' ]] && CLBody+=".${nest_membr}"
         CLBody+=" = ($arg_name)"
 
         [[ $M -gt 1 ]] && SFBody+=$'\n'"  "
-        SFBody+="opt_val.val.v_${UName}"
+        SFBody+="opt_val.val.${UName}"
         [[ $nested = 'yes' ]] && SFBody+=".${nest_membr}"
         SFBody+=" = ${arg_name};"
         

+ 2 - 2
scripts/d_options_enum.template

@@ -1,7 +1,7 @@
   /**
 {{EComment}}
    * The parameter value must be placed to the
-   * @a v_{{UName}} member.
+   * @a {{UName}} member.
    */
-  MHD_D_O_{{EName}} = {{Value}}
+  {{EName}} = {{Value}}
   ,

+ 2 - 2
scripts/d_options_func.template

@@ -4,11 +4,11 @@
  *         values
  */
 static MHD_INLINE struct MHD_DaemonOptionAndValue 
-MHD_DAEMON_OPTION_{{SName}} ({{SFArguments}})
+{{SName}} ({{SFArguments}})
 {
   struct MHD_DaemonOptionAndValue opt_val;
 
-  opt_val.opt = MHD_D_O_{{EName}};
+  opt_val.opt = {{EName}};
   {{SFBody}}
 
   return opt_val;

+ 2 - 2
scripts/d_options_macro.template

@@ -3,11 +3,11 @@
  * @return the object of struct MHD_DaemonOptionAndValue with the requested
  *         values
  */
-#define MHD_DAEMON_OPTION_{{SName}}({{MArguments}}) \
+#define {{SName}}({{MArguments}}) \
   MHD_NOWARN_COMPOUND_LITERALS_ \
   (const struct MHD_DaemonOptionAndValue) \
   { \
-    .opt = (MHD_D_O_{{EName}}), \
+    .opt = ({{EName}}), \
     {{CLBody}} \
   } \
   MHD_RESTORE_WARN_COMPOUND_LITERALS_

+ 2 - 2
scripts/d_options_struct.template

@@ -1,7 +1,7 @@
 /**
- * Data for #MHD_D_O_{{EName}}
+ * Data for #{{EName}}
  */
-{{UType}} v_{{UName}}
+{{UType}} {{UName}}
 {{{StBody}}
 };
 

+ 2 - 2
scripts/d_options_union.template

@@ -1,4 +1,4 @@
   /**
-   * Value for #MHD_D_O_{{EName}}
+   * Value for #{{EName}}
    */
-  {{UType}} v_{{UName}};
+  {{UType}} {{UName}};