xref: /OK3568_Linux_fs/external/camera_engine_rkaiq/rkaiq/tools/iq_check/script/m4/desc.sh (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1#!/bin/bash -e
2
3handle_size() {
4	# Should be int
5	echo -n \`\`\"[$1${2:+, $2}]\"\'\'
6}
7
8handle_digit() {
9	echo -n \`\`\"[$1${2:+, $2}]\"\'\'
10}
11
12handle_range() {
13	# Max should >= min
14	echo -n \`\`\"[$1, $2]\"\'\'
15}
16
17handle_hide() {
18	# Max should >= min
19	echo -n \`\`\"[$1, $2]\"\'\'
20}
21
22handle_struct() {
23	echo -n @desc: alias=\"$1\", type=\"struct\", ui_module=\"${2:-normal_ui_style}\", hide=\"${3:-0}\", ro=\"${4:-0}\"
24}
25
26handle_struct_list() {
27	echo -n @desc: alias=\"$1\", type=\"struct_list\", size=\"$2\", ui_module=\"${3:-normal_ui_style}\", ro=\"${4:-0}\", hide=\"${5:-0}\"
28}
29
30handle_number() {
31	echo -n @desc: alias=\"$1\", type=\"$2\", size=\"[1,1]\", range=\"$3\", default=\"$4\", digit=\"$5\", hide=\"${6:-0}\", ro=\"${7:-0}\"
32}
33
34handle_array() {
35	echo -n @desc: alias=\"$1\", type=\"$2\", size=\"$3\", range=\"$4\", default=\"$5\", digit=\"$6\", dynamic=\"$7\", hide=\"${8:-0}\", ro=\"${9:-0}\"
36}
37
38handle_array_mark() {
39	echo -n @desc: alias=\"$1\", type=\"$2\", size=\"$3\", range=\"$4\", default=\"$5\", digit=\"$6\", dynamic=\"$7\", ui_module=\"${8:-normal_ui_style}\", ro=\"${9:-0}\"
40}
41
42handle_string_mark() {
43	echo -n @desc: alias=\"$1\", type=\"string\", size=\"$2\", range=\"$3\", default=\"$4\", dynamic=\"$5\", ui_module_param=\"${6:-normal_ui_style}\", ro=\"${7:-0}\"
44}
45
46handle_number_mark() {
47	echo -n @desc: alias=\"$1\", type=\"$2\", range=\"$3\", default=\"$4\", digit=\"$5\", ui_module_param=\"${6:-normal_ui_style}\", ro=\"${7:-0}\", dynamic=\"${8:-0}\"
48}
49
50handle_array_table() {
51	echo -n @desc: alias=\"$1\", type=\"struct\", ui_module=\"$2\", index=\"$3\", hide=\"${4:-0}\", ro=\"${5:-0}\"
52}
53
54handle_string() {
55	echo -n @desc: alias=\"$1\", type=\"string\", size=\"$2\", range=\"$3\", default=\"$4\", dynamic=\"${5:-0}\", hide=\"${6:-0}\", ro=\"${7:-0}\"
56}
57
58handle_enum() {
59	echo -n @desc: type=\"enum\", alias=\"$1\", enum_def=\"$2\", default=\"$3\", ro=\"${4:-0}\"
60}
61
62handle_bool() {
63	echo -n @desc: type=\"bool\", alias=\"$1\", default=\"$2\", hide=\"${3:-0}\", ro=\"${4:-0}\"
64}
65
66echo "$@" >> ./m4.log
67MACRO=$1
68shift
69case $MACRO in
70	M4_SIZE)
71		handle_size "$@"
72		;;
73	M4_DIGIT)
74		handle_digit "$@"
75		;;
76	M4_RANGE)
77		handle_range "$@"
78		;;
79	M4_STRUCT_DESC)
80		handle_struct "$@"
81		;;
82	M4_STRUCT_LIST_DESC)
83		handle_struct_list "$@"
84		;;
85	M4_NUMBER_DESC)
86		handle_number "$@"
87		;;
88	M4_HIDE)
89		handle_hide "$@"
90		;;
91    M4_ARRAY_DESC)
92        handle_array "$@"
93        ;;
94    M4_ARRAY_MARK_DESC)
95        handle_array_mark "$@"
96        ;;
97    M4_STRING_MARK_DESC)
98        handle_string_mark "$@"
99        ;;
100    M4_NUMBER_MARK_DESC)
101        handle_number_mark "$@"
102        ;;
103    M4_ARRAY_TABLE_DESC)
104        handle_array_table "$@"
105        ;;
106	M4_STRING_DESC)
107		handle_string "$@"
108		;;
109	M4_ENUM_DESC)
110		handle_enum "$@"
111		;;
112	M4_BOOL_DESC)
113		handle_bool "$@"
114        ;;
115	*)
116		exit 0
117		;;
118esac
119