mirror of
https://git.gnunet.org/libmicrohttpd.git
synced 2026-09-25 04:09:31 +03:00
script updates
This commit is contained in:
+9
-11
@@ -7,31 +7,29 @@
|
||||
%singular: Value
|
||||
%mandatory: Value
|
||||
%mandatory: Comment
|
||||
%mandatory: Argument
|
||||
%mandatory: Description
|
||||
%mandatory: Argument1
|
||||
%mandatory: Description1
|
||||
%constraint: ( Value > 0 )
|
||||
|
||||
Name: suppress_date
|
||||
Value: 1
|
||||
Argument1: bool suppressed
|
||||
Description1: .
|
||||
Description1: some short description
|
||||
Comment: Suppresses the date header.
|
||||
+ * This option should only be set when the system lacks an RTC.
|
||||
+ *
|
||||
+ * @param bool true to not generate the Data header
|
||||
|
||||
Value: 2
|
||||
Name: cert_callback
|
||||
Value: 2
|
||||
Comment: Set TLS callback
|
||||
Argument1: Callback cb
|
||||
Description1: [in] callback
|
||||
Description1: callback
|
||||
Member1: opt.cb
|
||||
Argument2: void* cls
|
||||
Description2: [out] closure
|
||||
Description2: closure
|
||||
Member2: opt.cls
|
||||
|
||||
|
||||
Name: bind_address
|
||||
Value: 3
|
||||
Comment: Set IPv4 address to bind to
|
||||
Argument1: const struct sockaddr* in
|
||||
Argument1: const struct sockaddr *in
|
||||
Description1: the address
|
||||
|
||||
|
||||
+51
-18
@@ -27,6 +27,8 @@ fi
|
||||
|
||||
# parameters
|
||||
max_width=79
|
||||
input_rec="d_options.rec"
|
||||
tmp_rec="d_options_preproc.rec"
|
||||
|
||||
# cut string to given length at word boundary if possible
|
||||
cut_str_word () {
|
||||
@@ -50,14 +52,13 @@ cut_str_word () {
|
||||
format_param_descr() {
|
||||
local prefix1="$1" # first line prefix
|
||||
local desc="$2"
|
||||
local prefix2="$3" # prefix on all other lines
|
||||
local width="$4"
|
||||
local prefix2="$3" # prefix on all other lines
|
||||
local tmp_str
|
||||
declare -g format_param_descr_res=''
|
||||
[[ -z $3 ]] && prefix2=' *'
|
||||
[[ -z $width ]] && width=79
|
||||
prefix1="${prefix1#${prefix1%%[! ]*}}"
|
||||
prefix1="${prefix1%${prefix1##*[! ]}} " # trim prefix1
|
||||
[[ -z $width ]] && width=$max_width
|
||||
prefix1="${prefix1%${prefix1##*[! ]}} " # force single trailing space
|
||||
[[ -z $prefix2 ]] && prefix2="$prefix1"
|
||||
desc="${desc#${desc%%[! ]*}}"
|
||||
desc="${desc%${desc##*[! ]}}" # trim desc
|
||||
local width_r=$(( width - ${#prefix1} ))
|
||||
@@ -76,39 +77,71 @@ ${prefix2}${tmp_str:${#prefix2}}"
|
||||
return 0
|
||||
}
|
||||
|
||||
cat << _EOF_ > "$tmp_rec"
|
||||
%rec: MHD_Option_preproc
|
||||
%mandatory: Value
|
||||
%mandatory: Name
|
||||
%type: Value int
|
||||
|
||||
cp d_options.rec tmp.rec || exit 2
|
||||
_EOF_
|
||||
|
||||
for N in $(recsel -t MHD_Option -R Value d_options.rec)
|
||||
echo "Processing input file..."
|
||||
for N in $(recsel -t MHD_Option -R Value "$input_rec")
|
||||
do
|
||||
NAME=$(recsel -t MHD_Option -P Name -e "Value=$N" d_options.rec)
|
||||
COMMENT=$(recsel -t MHD_Option -P Comment -e "Value=$N" d_options.rec)
|
||||
NAME=$(recsel -t MHD_Option -P Name -e "Value=$N" "$input_rec")
|
||||
COMMENT=$(recsel -t MHD_Option -P Comment -e "Value=$N" "$input_rec")
|
||||
ARGS=( )
|
||||
DESCRS=( )
|
||||
MEMBRS=( )
|
||||
[[ -n $NAME ]] || exit 2
|
||||
if [[ -z $NAME ]]; then
|
||||
echo "The name field is empty for 'Value=$N'" >&2
|
||||
exit 2
|
||||
fi
|
||||
EComment=""
|
||||
EName=""
|
||||
FComment=""
|
||||
MArguments=""
|
||||
CLBody=""
|
||||
SFArguments=""
|
||||
SFBody=""
|
||||
M=1
|
||||
while
|
||||
ARGM=$(recsel -t MHD_Option -P Argument${M} -e "Value=$N" d_options.rec)
|
||||
ARGM=$(recsel -t MHD_Option -P Argument${M} -e "Value=$N" "$input_rec")
|
||||
[[ -n $ARGM ]]
|
||||
do
|
||||
ARGS+=( "$ARGM" )
|
||||
DESCRM=$(recsel -t MHD_Option -P Description${M} -e "Value=$N" d_options.rec)
|
||||
DESCRM=$(recsel -t MHD_Option -P Description${M} -e "Value=$N" "$input_rec")
|
||||
if [[ -z $DESCRM ]]; then
|
||||
echo "Empty Description${M} for argument \"$ARGM\" for $NAME" >&2
|
||||
exit 2
|
||||
fi
|
||||
DESCRS+=( "$DESCRM" )
|
||||
MEMBRM=$(recsel -t MHD_Option -P Member${M} -e "Value=$N" d_options.rec)
|
||||
MEMBRM=$(recsel -t MHD_Option -P Member${M} -e "Value=$N" "$input_rec")
|
||||
[[ -z $MEMBRM ]] && MEMBRM="$ARGM"
|
||||
MEMBRS+=( "$MEMBRM" )
|
||||
arg_name="${ARGM##* }"
|
||||
arg_name="${arg_name#\*}"
|
||||
arg_type="${ARGM%${arg_name}}"
|
||||
arg_type="${arg_type% }"
|
||||
(( M++ ))
|
||||
done
|
||||
CBODY=""
|
||||
MBODY=""
|
||||
SBODY=""
|
||||
echo $N - $NAME
|
||||
recins -t MHD_Option_preproc \
|
||||
-f Value -v "$N" \
|
||||
-f Name -v "$NAME" \
|
||||
-f EComment -v "$EComment" \
|
||||
-f EName -v "$EName" \
|
||||
-f MArguments -v "$MArguments" \
|
||||
-f CLBody -v "$CLBody" \
|
||||
-f SFArguments -v "$SFArguments" \
|
||||
-f SFBody -v "$SFBody" \
|
||||
"$tmp_rec"
|
||||
done
|
||||
echo "finished."
|
||||
|
||||
# recfmt -f d_option1.template tmp.rec
|
||||
# recfmt -f d_option2.template tmp.rec
|
||||
echo "Generating output files..."
|
||||
# recfmt -f d_option0.template "$tmp_rec"
|
||||
# recfmt -f d_option1.template "$tmp_rec"
|
||||
# recfmt -f d_option2.template "$tmp_rec"
|
||||
# rm "$tmp_rec"
|
||||
echo "finished."
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
/**
|
||||
{{EComment}}
|
||||
*/
|
||||
MHD_D_O_{{EName}} = {{Value}}
|
||||
{{EComma}}
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* {{Comments}}
|
||||
{{Comment}}
|
||||
*/
|
||||
#define MHD_daemon_set_{{Name}}({{MArguments}}) \
|
||||
(struct MHD_Option){ {{MBody}} }
|
||||
(struct MHD_Option){ {{CLBody}} }
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
/**
|
||||
* {{Comments}}
|
||||
{{Comment}}
|
||||
*/
|
||||
inline static enum MHD_Option
|
||||
MHD_daemon_set_{{Name}} ({{Arguments}}) {
|
||||
MHD_daemon_set_{{Name}} ({{SFArguments}}) {
|
||||
struct MHD_Option opt;
|
||||
|
||||
{{CBody}}
|
||||
{{SFBody}}
|
||||
return opt;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user