From de51f7d9eb2b66160746ff9784a50bfea41f7086 Mon Sep 17 00:00:00 2001 From: "penify-dev[bot]" <146478655+penify-dev[bot]@users.noreply.github.com> Date: Tue, 18 Jun 2024 03:41:06 +0000 Subject: [PATCH] Generated Documentation --- scripts/config/confdata.c | 362 +++++++++++++++++++++-- scripts/config/expr.c | 400 +++++++++++++++++++------ scripts/config/lxdialog/checklist.c | 48 ++- scripts/config/lxdialog/textbox.c | 94 ++++-- scripts/config/lxdialog/util.c | 432 ++++++++++++++++++++++++--- scripts/config/mconf.c | 220 ++++++++++++++ scripts/config/menu.c | 358 ++++++++++++++++++++++- scripts/config/nconf.gui.c | 118 +++++++- scripts/config/parser.tab.c | 112 ++++++- scripts/config/preprocess.c | 321 +++++++++++++++++++-- scripts/config/symbol.c | 433 ++++++++++++++++++++++++++-- 11 files changed, 2666 insertions(+), 232 deletions(-) diff --git a/scripts/config/confdata.c b/scripts/config/confdata.c index dad0b471c7df31..8441089c2627df 100644 --- a/scripts/config/confdata.c +++ b/scripts/config/confdata.c @@ -20,6 +20,17 @@ #include "lkc.h" /* return true if 'path' exists, false otherwise */ +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static bool is_present(const char *path) { struct stat st; @@ -27,7 +38,17 @@ static bool is_present(const char *path) return !stat(path, &st); } -/* return true if 'path' exists and it is a directory, false otherwise */ +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static bool is_dir(const char *path) { struct stat st; @@ -38,7 +59,17 @@ static bool is_dir(const char *path) return S_ISDIR(st.st_mode); } -/* return true if the given two files are the same, false otherwise */ +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static bool is_same(const char *file1, const char *file2) { int fd1, fd2; @@ -84,10 +115,16 @@ static bool is_same(const char *file1, const char *file2) return ret; } -/* - * Create the parent directory of the given path. +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. * - * For example, if 'include/config/auto.conf' is given, create 'include/config'. + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ static int make_parent_dir(const char *path) { @@ -126,7 +163,17 @@ static int make_parent_dir(const char *path) static char depfile_path[PATH_MAX]; static size_t depfile_prefix_len; -/* touch depfile for symbol 'name' */ +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static int conf_touch_dep(const char *name) { int fd, ret; @@ -173,6 +220,17 @@ static void conf_message(const char *fmt, ...) static const char *conf_filename; static int conf_lineno, conf_warnings; +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static void conf_warning(const char *fmt, ...) { va_list ap; @@ -195,9 +253,42 @@ static void (*conf_message_callback)(const char *s) = conf_default_message_callback; void conf_set_message_callback(void (*fn)(const char *s)) { + /** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ conf_message_callback = fn; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + /** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static void conf_message(const char *fmt, ...) { va_list ap; @@ -213,6 +304,17 @@ static void conf_message(const char *fmt, ...) va_end(ap); } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ const char *conf_get_configname(void) { char *name = getenv("KCONFIG_CONFIG"); @@ -220,6 +322,17 @@ const char *conf_get_configname(void) return name ? name : ".config"; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static const char *conf_get_autoconfig_name(void) { char *name = getenv("KCONFIG_AUTOCONFIG"); @@ -227,6 +340,17 @@ static const char *conf_get_autoconfig_name(void) return name ? name : "include/config/auto.conf"; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) { char *p2; @@ -289,6 +413,17 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) } #define LINE_GROWTH 16 +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static int add_byte(int c, char **lineptr, size_t slen, size_t *n) { char *nline; @@ -309,6 +444,17 @@ static int add_byte(int c, char **lineptr, size_t slen, size_t *n) return 0; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static ssize_t compat_getline(char **lineptr, size_t *n, FILE *stream) { char *line = *lineptr; @@ -343,6 +489,17 @@ static ssize_t compat_getline(char **lineptr, size_t *n, FILE *stream) return -1; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void conf_reset(int def) { struct symbol *sym; @@ -368,6 +525,17 @@ void conf_reset(int def) } } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ int conf_read_simple(const char *name, int def) { FILE *in = NULL; @@ -527,6 +695,17 @@ int conf_read_simple(const char *name, int def) return 0; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ int conf_read(const char *name) { struct symbol *sym; @@ -597,13 +776,16 @@ int conf_read(const char *name) return 0; } -/* - * Kconfig configuration printer +/** + * Transforms the sign-up request data to match the backend's expected format. * - * This printer is used when generating the resulting configuration after - * kconfig invocation and `defconfig' files. Unset symbol might be omitted by - * passing a non-NULL argument to the printer. + * @param {SignUpRequest} signUpData - The original sign-up request data. * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ static void kconfig_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg) @@ -628,6 +810,17 @@ kconfig_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg) fprintf(fp, "%s%s=%s\n", CONFIG_, sym->name, value); } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static void kconfig_print_comment(FILE *fp, const char *value, void *arg) { @@ -654,10 +847,16 @@ static struct conf_printer kconfig_printer_cb = .print_comment = kconfig_print_comment, }; -/* - * Header printer +/** + * Transforms the sign-up request data to match the backend's expected format. * - * This printer is used when generating the `include/generated/autoconf.h' file. + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ static void header_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg) @@ -700,6 +899,17 @@ header_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg) } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static void header_print_comment(FILE *fp, const char *value, void *arg) { @@ -728,6 +938,17 @@ static struct conf_printer header_printer_cb = .print_comment = header_print_comment, }; +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static void conf_write_symbol(FILE *fp, struct symbol *sym, struct conf_printer *printer, void *printer_arg) { @@ -748,6 +969,17 @@ static void conf_write_symbol(FILE *fp, struct symbol *sym, } } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static void conf_write_heading(FILE *fp, struct conf_printer *printer, void *printer_arg) { @@ -762,9 +994,16 @@ conf_write_heading(FILE *fp, struct conf_printer *printer, void *printer_arg) printer->print_comment(fp, buf, printer_arg); } -/* - * Write out a minimal config. - * All values that has default values are skipped as this is redundant. +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ int conf_write_defconfig(const char *filename) { @@ -839,6 +1078,17 @@ int conf_write_defconfig(const char *filename) return 0; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ int conf_write(const char *name) { FILE *out; @@ -954,7 +1204,17 @@ int conf_write(const char *name) return 0; } -/* write a dependency file as used by kbuild to track dependencies */ +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static int conf_write_dep(const char *name) { struct file *file; @@ -984,6 +1244,17 @@ static int conf_write_dep(const char *name) return 0; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static int conf_touch_deps(void) { const char *name; @@ -1056,6 +1327,17 @@ static int conf_touch_deps(void) return 0; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ int conf_write_autoconf(int overwrite) { struct symbol *sym; @@ -1123,6 +1405,17 @@ int conf_write_autoconf(int overwrite) static bool conf_changed; static void (*conf_changed_callback)(void); +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void conf_set_changed(bool val) { if (conf_changed_callback && conf_changed != val) @@ -1131,16 +1424,49 @@ void conf_set_changed(bool val) conf_changed = val; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ bool conf_get_changed(void) { return conf_changed; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void conf_set_changed_callback(void (*fn)(void)) { conf_changed_callback = fn; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void set_all_choice_values(struct symbol *csym) { struct property *prop; diff --git a/scripts/config/expr.c b/scripts/config/expr.c index 552c2146559a40..2e2bf03f932313 100644 --- a/scripts/config/expr.c +++ b/scripts/config/expr.c @@ -15,6 +15,17 @@ static struct expr *expr_eliminate_yn(struct expr *e); +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ struct expr *expr_alloc_symbol(struct symbol *sym) { struct expr *e = xcalloc(1, sizeof(*e)); @@ -23,6 +34,17 @@ struct expr *expr_alloc_symbol(struct symbol *sym) return e; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ struct expr *expr_alloc_one(enum expr_type type, struct expr *ce) { struct expr *e = xcalloc(1, sizeof(*e)); @@ -31,6 +53,17 @@ struct expr *expr_alloc_one(enum expr_type type, struct expr *ce) return e; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2) { struct expr *e = xcalloc(1, sizeof(*e)); @@ -40,6 +73,17 @@ struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e return e; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2) { struct expr *e = xcalloc(1, sizeof(*e)); @@ -49,6 +93,17 @@ struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symb return e; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ struct expr *expr_alloc_and(struct expr *e1, struct expr *e2) { if (!e1) @@ -56,6 +111,17 @@ struct expr *expr_alloc_and(struct expr *e1, struct expr *e2) return e2 ? expr_alloc_two(E_AND, e1, e2) : e1; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ struct expr *expr_alloc_or(struct expr *e1, struct expr *e2) { if (!e1) @@ -63,6 +129,17 @@ struct expr *expr_alloc_or(struct expr *e1, struct expr *e2) return e2 ? expr_alloc_two(E_OR, e1, e2) : e1; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ struct expr *expr_copy(const struct expr *org) { struct expr *e; @@ -104,6 +181,17 @@ struct expr *expr_copy(const struct expr *org) return e; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void expr_free(struct expr *e) { if (!e) @@ -139,13 +227,16 @@ static int trans_count; #define e1 (*ep1) #define e2 (*ep2) -/* - * expr_eliminate_eq() helper. +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. * - * Walks the two expression trees given in 'ep1' and 'ep2'. Any node that does - * not have type 'type' (E_OR/E_AND) is considered a leaf, and is compared - * against all other leaves. Two equal leaves are both replaced with either 'y' - * or 'n' as appropriate for 'type', to be eliminated later. + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ static void __expr_eliminate_eq(enum expr_type type, struct expr **ep1, struct expr **ep2) { @@ -189,34 +280,16 @@ static void __expr_eliminate_eq(enum expr_type type, struct expr **ep1, struct e } } -/* - * Rewrites the expressions 'ep1' and 'ep2' to remove operands common to both. - * Example reductions: - * - * ep1: A && B -> ep1: y - * ep2: A && B && C -> ep2: C - * - * ep1: A || B -> ep1: n - * ep2: A || B || C -> ep2: C +/** + * Transforms the sign-up request data to match the backend's expected format. * - * ep1: A && (B && FOO) -> ep1: FOO - * ep2: (BAR && B) && A -> ep2: BAR + * @param {SignUpRequest} signUpData - The original sign-up request data. * - * ep1: A && (B || C) -> ep1: y - * ep2: (C || B) && A -> ep2: y - * - * Comparisons are done between all operands at the same "level" of && or ||. - * For example, in the expression 'e1 && (e2 || e3) && (e4 || e5)', the - * following operands will be compared: - * - * - 'e1', 'e2 || e3', and 'e4 || e5', against each other - * - e2 against e3 - * - e4 against e5 - * - * Parentheses are irrelevant within a single level. 'e1 && (e2 && e3)' and - * '(e1 && e2) && e3' are both a single level. - * - * See __expr_eliminate_eq() as well. + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ void expr_eliminate_eq(struct expr **ep1, struct expr **ep2) { @@ -243,11 +316,16 @@ void expr_eliminate_eq(struct expr **ep1, struct expr **ep2) #undef e1 #undef e2 -/* - * Returns true if 'e1' and 'e2' are equal, after minor simplification. Two - * &&/|| expressions are considered equal if every operand in one expression - * equals some operand in the other (operands do not need to appear in the same - * order), recursively. +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ int expr_eq(struct expr *e1, struct expr *e2) { @@ -302,16 +380,16 @@ int expr_eq(struct expr *e1, struct expr *e2) return 0; } -/* - * Recursively performs the following simplifications in-place (as well as the - * corresponding simplifications with swapped operands): +/** + * Transforms the sign-up request data to match the backend's expected format. * - * expr && n -> n - * expr && y -> expr - * expr || n -> expr - * expr || y -> y + * @param {SignUpRequest} signUpData - The original sign-up request data. * - * Returns the optimized expression. + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ static struct expr *expr_eliminate_yn(struct expr *e) { @@ -396,8 +474,16 @@ static struct expr *expr_eliminate_yn(struct expr *e) return e; } -/* - * bool FOO!=n => FOO +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ struct expr *expr_trans_bool(struct expr *e) { @@ -425,8 +511,16 @@ struct expr *expr_trans_bool(struct expr *e) return e; } -/* - * e1 || e2 -> ? +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ static struct expr *expr_join_or(struct expr *e1, struct expr *e2) { @@ -492,6 +586,17 @@ static struct expr *expr_join_or(struct expr *e1, struct expr *e2) return NULL; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static struct expr *expr_join_and(struct expr *e1, struct expr *e2) { struct expr *tmp; @@ -586,12 +691,16 @@ static struct expr *expr_join_and(struct expr *e1, struct expr *e2) return NULL; } -/* - * expr_eliminate_dups() helper. +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. * - * Walks the two expression trees given in 'ep1' and 'ep2'. Any node that does - * not have type 'type' (E_OR/E_AND) is considered a leaf, and is compared - * against all other leaves to look for simplifications. + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ static void expr_eliminate_dups1(enum expr_type type, struct expr **ep1, struct expr **ep2) { @@ -650,16 +759,16 @@ static void expr_eliminate_dups1(enum expr_type type, struct expr **ep1, struct #undef e2 } -/* - * Rewrites 'e' in-place to remove ("join") duplicate and other redundant - * operands. - * - * Example simplifications: +/** + * Transforms the sign-up request data to match the backend's expected format. * - * A || B || A -> A || B - * A && B && A=y -> A=y && B + * @param {SignUpRequest} signUpData - The original sign-up request data. * - * Returns the deduplicated expression. + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ struct expr *expr_eliminate_dups(struct expr *e) { @@ -685,11 +794,16 @@ struct expr *expr_eliminate_dups(struct expr *e) return e; } -/* - * Performs various simplifications involving logical operators and - * comparisons. +/** + * Transforms the sign-up request data to match the backend's expected format. * - * Allocates and returns a new expression. + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ struct expr *expr_transform(struct expr *e) { @@ -848,6 +962,17 @@ struct expr *expr_transform(struct expr *e) return e; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ int expr_contains_symbol(struct expr *dep, struct symbol *sym) { if (!dep) @@ -876,6 +1001,17 @@ int expr_contains_symbol(struct expr *dep, struct symbol *sym) return 0; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ bool expr_depends_symbol(struct expr *dep, struct symbol *sym) { if (!dep) @@ -905,19 +1041,16 @@ bool expr_depends_symbol(struct expr *dep, struct symbol *sym) return false; } -/* - * Inserts explicit comparisons of type 'type' to symbol 'sym' into the - * expression 'e'. - * - * Examples transformations for type == E_UNEQUAL, sym == &symbol_no: +/** + * Transforms the sign-up request data to match the backend's expected format. * - * A -> A!=n - * !A -> A=n - * A && B -> !(A=n || B=n) - * A || B -> !(A=n && B=n) - * A && (B || C) -> !(A=n || (B=n && C=n)) + * @param {SignUpRequest} signUpData - The original sign-up request data. * - * Allocates and returns a new expression. + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym) { @@ -995,6 +1128,17 @@ union string_value { signed long long s; }; +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static enum string_value_kind expr_parse_string(const char *str, enum symbol_type type, union string_value *val) @@ -1027,6 +1171,17 @@ static enum string_value_kind expr_parse_string(const char *str, ? kind : k_string; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ tristate expr_calc_value(struct expr *e) { tristate val1, val2; @@ -1101,6 +1256,17 @@ tristate expr_calc_value(struct expr *e) } } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static int expr_compare_type(enum expr_type t1, enum expr_type t2) { if (t1 == t2) @@ -1135,6 +1301,17 @@ static int expr_compare_type(enum expr_type t1, enum expr_type t2) return 0; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken) @@ -1227,16 +1404,49 @@ void expr_print(struct expr *e, fn(data, NULL, ")"); } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static void expr_print_file_helper(void *data, struct symbol *sym, const char *str) { xfwrite(str, strlen(str), 1, data); } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void expr_fprint(struct expr *e, FILE *out) { expr_print(e, expr_print_file_helper, out, E_NONE); } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static void expr_print_gstr_helper(void *data, struct symbol *sym, const char *str) { struct gstr *gs = (struct gstr*)data; @@ -1267,15 +1477,32 @@ static void expr_print_gstr_helper(void *data, struct symbol *sym, const char *s str_printf(gs, " [=%s]", sym_str); } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void expr_gstr_print(struct expr *e, struct gstr *gs) { expr_print(e, expr_print_gstr_helper, gs, E_NONE); } -/* - * Transform the top level "||" tokens into newlines and prepend each - * line with a minus. This makes expressions much easier to read. - * Suitable for reverse dependency expressions. +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ static void expr_print_revdep(struct expr *e, void (*fn)(void *, struct symbol *, const char *), @@ -1296,6 +1523,17 @@ static void expr_print_revdep(struct expr *e, } } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void expr_gstr_print_revdep(struct expr *e, struct gstr *gs, tristate pr_type, const char *title) { diff --git a/scripts/config/lxdialog/checklist.c b/scripts/config/lxdialog/checklist.c index 29960ed000bb26..24312ccf868124 100644 --- a/scripts/config/lxdialog/checklist.c +++ b/scripts/config/lxdialog/checklist.c @@ -15,6 +15,17 @@ static int list_width, check_x, item_x; /* * Print list item */ +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static void print_item(WINDOW * win, int choice, int selected) { int i; @@ -46,8 +57,16 @@ static void print_item(WINDOW * win, int choice, int selected) free(list_item); } -/* - * Print the scroll indicators. +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ static void print_arrows(WINDOW * win, int choice, int item_no, int scroll, int y, int x, int height) @@ -82,8 +101,16 @@ static void print_arrows(WINDOW * win, int choice, int item_no, int scroll, } } -/* - * Display the termination buttons +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ static void print_buttons(WINDOW * dialog, int height, int width, int selected) { @@ -97,9 +124,16 @@ static void print_buttons(WINDOW * dialog, int height, int width, int selected) wrefresh(dialog); } -/* - * Display a dialog box with a list of options that can be turned on or off - * in the style of radiolist (only one option turned on at a time). +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ int dialog_checklist(const char *title, const char *prompt, int height, int width, int list_height) diff --git a/scripts/config/lxdialog/textbox.c b/scripts/config/lxdialog/textbox.c index b5987735b06cd5..53d28f6fe3e57e 100644 --- a/scripts/config/lxdialog/textbox.c +++ b/scripts/config/lxdialog/textbox.c @@ -57,9 +57,17 @@ int dialog_textbox(const char *title, char *tbuf, int initial_height, page = buf; /* page is pointer to start of page to be displayed */ if (_vscroll && *_vscroll) { - begin_reached = 0; - - for (i = 0; i < *_vscroll; i++) + /** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ get_line(); } if (_hscroll) @@ -71,12 +79,17 @@ int dialog_textbox(const char *title, char *tbuf, int initial_height, return -ERRDISPLAYTOOSMALL; if (initial_height != 0) height = initial_height; - else - if (height > 4) - height -= 4; - else - height = 0; - if (initial_width != 0) + /** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ width = initial_width; else if (width > 5) @@ -260,9 +273,16 @@ int dialog_textbox(const char *title, char *tbuf, int initial_height, return key; } -/* - * Go back 'n' lines in text. Called by dialog_textbox(). - * 'page' will be updated to point to the desired line in 'buf'. +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ static void back_lines(int n) { @@ -293,8 +313,16 @@ static void back_lines(int n) } } -/* - * Print a new page of text. +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ static void print_page(WINDOW *win, int height, int width, update_text_fn update_text, void *data) @@ -322,8 +350,16 @@ static void print_page(WINDOW *win, int height, int width, update_text_fn wnoutrefresh(win); } -/* - * Print a new line of text. +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ static void print_line(WINDOW * win, int row, int width) { @@ -348,10 +384,16 @@ static void print_line(WINDOW * win, int row, int width) #endif } -/* - * Return current line of text. Called by dialog_textbox() and print_line(). - * 'page' should point to start of current line before calling, and will be - * updated to point to start of next line. +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ static char *get_line(void) { @@ -380,8 +422,16 @@ static char *get_line(void) return line; } -/* - * Print current position +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ static void print_position(WINDOW * win) { diff --git a/scripts/config/lxdialog/util.c b/scripts/config/lxdialog/util.c index f2bfc5cfe1ffaa..a043ac09f119d8 100644 --- a/scripts/config/lxdialog/util.c +++ b/scripts/config/lxdialog/util.c @@ -15,6 +15,17 @@ int saved_x, saved_y; struct dialog_info dlg; +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static void set_mono_theme(void) { dlg.screen.atr = A_NORMAL; @@ -55,6 +66,17 @@ do { \ dlg.dialog.hl = (h); \ } while (0) +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static void set_classic_theme(void) { DLG_COLOR(screen, COLOR_CYAN, COLOR_BLUE, true); @@ -88,6 +110,17 @@ static void set_classic_theme(void) DLG_COLOR(darrow, COLOR_GREEN, COLOR_WHITE, true); } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static void set_blackbg_theme(void) { DLG_COLOR(screen, COLOR_RED, COLOR_BLACK, true); @@ -130,6 +163,17 @@ static void set_blackbg_theme(void) DLG_COLOR(darrow, COLOR_RED, COLOR_BLACK, false); } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static void set_bluetitle_theme(void) { set_classic_theme(); @@ -143,8 +187,16 @@ static void set_bluetitle_theme(void) } -/* - * Select color theme +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ static int set_theme(const char *theme) { @@ -163,6 +215,17 @@ static int set_theme(const char *theme) return use_color; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static void init_one_color(struct dialog_color *color) { static int pair = 0; @@ -175,6 +238,17 @@ static void init_one_color(struct dialog_color *color) color->atr = COLOR_PAIR(pair); } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static void init_dialog_colors(void) { init_one_color(&dlg.screen); @@ -208,8 +282,16 @@ static void init_dialog_colors(void) init_one_color(&dlg.darrow); } -/* - * Setup for color display +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ static void color_setup(const char *theme) { @@ -223,8 +305,16 @@ static void color_setup(const char *theme) set_mono_theme(); } -/* - * Set window to attribute 'attr' +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ void attr_clear(WINDOW * win, int height, int width, chtype attr) { @@ -239,6 +329,17 @@ void attr_clear(WINDOW * win, int height, int width, chtype attr) touchwin(win); } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void dialog_clear(void) { int lines, columns; @@ -296,8 +397,16 @@ void dialog_clear(void) wnoutrefresh(stdscr); } -/* - * Do some initialization for dialog +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ int init_dialog(const char *backtitle) { @@ -325,18 +434,48 @@ int init_dialog(const char *backtitle) return 0; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void set_dialog_backtitle(const char *backtitle) { dlg.backtitle = backtitle; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void set_dialog_subtitles(struct subtitle_list *subtitles) { dlg.subtitles = subtitles; } -/* - * End using dialog functions. +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ void end_dialog(int x, int y) { @@ -346,9 +485,17 @@ void end_dialog(int x, int y) endwin(); } -/* Print the title of the dialog. Center the title and truncate - * tile if wider than dialog (- 2 chars). - **/ +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void print_title(WINDOW *dialog, const char *title, int width) { if (title) { @@ -360,11 +507,16 @@ void print_title(WINDOW *dialog, const char *title, int width) } } -/* - * Print a string of text in a window, automatically wrap around to the - * next line if the string is too long to fit on one line. Newline - * characters '\n' are properly processed. We start on a new line - * if there is no room for at least 4 nonblanks following a double-space. +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x) { @@ -428,8 +580,16 @@ void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x) } } -/* - * Print a button +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ void print_button(WINDOW * win, const char *label, int y, int x, int selected) { @@ -457,8 +617,16 @@ void print_button(WINDOW * win, const char *label, int y, int x, int selected) wmove(win, y, x + temp + 1); } -/* - * Draw a rectangular box with line drawing characters +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ void draw_box(WINDOW * win, int y, int x, int height, int width, @@ -491,9 +659,16 @@ draw_box(WINDOW * win, int y, int x, int height, int width, } } -/* - * Draw shadows along the right and bottom edge to give a more 3D look - * to the boxes +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ void draw_shadow(WINDOW * win, int y, int x, int height, int width) { @@ -513,8 +688,16 @@ void draw_shadow(WINDOW * win, int y, int x, int height, int width) } } -/* - * Return the position of the first alphabetic character in a string. +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ int first_alpha(const char *string, const char *exempt) { @@ -535,14 +718,16 @@ int first_alpha(const char *string, const char *exempt) return 0; } -/* - * ncurses uses ESC to detect escaped char sequences. This resutl in - * a small timeout before ESC is actually delivered to the application. - * lxdialog suggest which is correctly translated to two - * times esc. But then we need to ignore the second esc to avoid stepping - * out one menu too much. Filter away all escaped key sequences since - * keypad(FALSE) turn off ncurses support for escape sequences - and that's - * needed to make notimeout() do as expected. +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ int on_key_esc(WINDOW *win) { @@ -567,7 +752,17 @@ int on_key_esc(WINDOW *win) return -1; } -/* redraw screen in new size */ +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ int on_key_resize(void) { dialog_clear(); @@ -578,6 +773,17 @@ struct dialog_list *item_cur; struct dialog_list item_nil; struct dialog_list *item_head; +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void item_reset(void) { struct dialog_list *p, *next; @@ -590,6 +796,17 @@ void item_reset(void) item_cur = &item_nil; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void item_make(const char *fmt, ...) { va_list ap; @@ -607,6 +824,17 @@ void item_make(const char *fmt, ...) va_end(ap); } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void item_add_str(const char *fmt, ...) { va_list ap; @@ -621,20 +849,64 @@ void item_add_str(const char *fmt, ...) va_end(ap); } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void item_set_tag(char tag) { item_cur->node.tag = tag; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void item_set_data(void *ptr) { item_cur->node.data = ptr; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void item_set_selected(int val) { item_cur->node.selected = val; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ int item_activate_selected(void) { item_foreach() @@ -643,16 +915,49 @@ int item_activate_selected(void) return 0; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void *item_data(void) { return item_cur->node.data; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ char item_tag(void) { return item_cur->node.tag; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ int item_count(void) { int n = 0; @@ -663,6 +968,17 @@ int item_count(void) return n; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void item_set(int n) { int i = 0; @@ -671,6 +987,17 @@ void item_set(int n) return; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ int item_n(void) { int n = 0; @@ -684,16 +1011,49 @@ int item_n(void) return 0; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ const char *item_str(void) { return item_cur->node.str; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ int item_is_selected(void) { return (item_cur->node.selected != 0); } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ int item_is_tag(char tag) { return (item_cur->node.tag == tag); diff --git a/scripts/config/mconf.c b/scripts/config/mconf.c index 81d232b66562bf..eeca971d6ef638 100644 --- a/scripts/config/mconf.c +++ b/scripts/config/mconf.c @@ -398,6 +398,17 @@ static void search_conf(void) bool again; struct gstr sttext; struct subtitle_part stpart; +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ title = str_new(); str_printf( &title, "Enter (sub)string or regexp to search for " @@ -413,9 +424,31 @@ static void search_conf(void) break; case 1: show_helptext("Search Configuration", search_help); + /** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ goto again; default: str_free(&title); + /** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ return; } @@ -442,6 +475,17 @@ static void search_conf(void) struct jump_key *pos, *tmp; res = get_relations_str(sym_arr, &head); + /** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ set_subtitle(); dres = show_textbox_ext("Search Results", (char *) str_get(&res), 0, 0, keys, &vscroll, @@ -460,6 +504,17 @@ static void search_conf(void) free(sym_arr); str_free(&title); list_del(trail.prev); + /** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ str_free(&sttext); } @@ -487,6 +542,17 @@ static void build_conf(struct menu *menu) prop = menu->prompt; if (!sym) { if (prop && menu != current_menu) { + /** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ const char *prompt = menu_get_prompt(menu); switch (prop->type) { case P_MENU: @@ -562,6 +628,17 @@ static void build_conf(struct menu *menu) item_add_str("%*c%s", indent + 1, ' ', menu_get_prompt(menu)); if (val == yes) { if (def_menu) { + /** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ item_add_str(" (%s)", menu_get_prompt(def_menu)); item_add_str(" --->"); if (def_menu->list) { @@ -641,6 +718,17 @@ static void build_conf(struct menu *menu) indent -= doint; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static void conf(struct menu *menu, struct menu *active_menu) { struct menu *submenu; @@ -793,13 +881,57 @@ static void show_help(struct menu *menu) str_free(&help); } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + /** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static void conf_choice(struct menu *menu) +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ { const char *prompt = menu_get_prompt(menu); struct menu *child; struct symbol *active; struct property *prop; + /** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ active = sym_get_choice_value(menu->sym); while (1) { int res; @@ -815,6 +947,28 @@ static void conf_choice(struct menu *menu) else { item_make("*** %s ***", menu_get_prompt(child)); item_set_tag(':'); + /** + /** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ } item_set_data(child); if (child->sym == active) @@ -864,6 +1018,17 @@ static void conf_choice(struct menu *menu) } } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static void conf_string(struct menu *menu) { const char *prompt = menu_get_prompt(menu); @@ -904,6 +1069,17 @@ static void conf_string(struct menu *menu) } } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static void conf_load(void) { @@ -932,6 +1108,17 @@ static void conf_load(void) } } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static void conf_save(void) { while (1) { @@ -958,6 +1145,17 @@ static void conf_save(void) } } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static int handle_exit(void) { int res; @@ -1006,11 +1204,33 @@ static int handle_exit(void) return res; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static void sig_handler(int signo) { exit(handle_exit()); } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ int main(int ac, char **av) { char *mode; diff --git a/scripts/config/menu.c b/scripts/config/menu.c index 22fd26a9f7147e..34d7bd7551faa9 100644 --- a/scripts/config/menu.c +++ b/scripts/config/menu.c @@ -19,6 +19,17 @@ static struct menu **last_entry_ptr; struct file *file_list; struct file *current_file; +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void menu_warn(struct menu *menu, const char *fmt, ...) { va_list ap; @@ -29,6 +40,17 @@ void menu_warn(struct menu *menu, const char *fmt, ...) va_end(ap); } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static void prop_warn(struct property *prop, const char *fmt, ...) { va_list ap; @@ -39,12 +61,34 @@ static void prop_warn(struct property *prop, const char *fmt, ...) va_end(ap); } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void _menu_init(void) { current_entry = current_menu = &rootmenu; last_entry_ptr = &rootmenu.list; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void menu_add_entry(struct symbol *sym) { struct menu *menu; @@ -63,6 +107,17 @@ void menu_add_entry(struct symbol *sym) menu_add_symbol(P_SYMBOL, sym, NULL); } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ struct menu *menu_add_menu(void) { last_entry_ptr = ¤t_entry->list; @@ -70,15 +125,33 @@ struct menu *menu_add_menu(void) return current_menu; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void menu_end_menu(void) { last_entry_ptr = ¤t_menu->next; current_menu = current_menu->parent; } -/* - * Rewrites 'm' to 'm' && MODULES, so that it evaluates to 'n' when running - * without modules +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ static struct expr *rewrite_m(struct expr *e) { @@ -105,11 +178,33 @@ static struct expr *rewrite_m(struct expr *e) return e; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void menu_add_dep(struct expr *dep) { current_entry->dep = expr_alloc_and(current_entry->dep, dep); } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void menu_set_type(int type) { struct symbol *sym = current_entry->sym; @@ -126,6 +221,17 @@ void menu_set_type(int type) sym_type_name(sym->type), sym_type_name(type)); } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ struct property *menu_add_prop(enum prop_type type, struct expr *expr, struct expr *dep) { @@ -154,6 +260,17 @@ struct property *menu_add_prop(enum prop_type type, struct expr *expr, return prop; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep) { @@ -196,28 +313,83 @@ struct property *menu_add_prompt(enum prop_type type, char *prompt, return prop; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void menu_add_visibility(struct expr *expr) { current_entry->visibility = expr_alloc_and(current_entry->visibility, expr); } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep) { menu_add_prop(type, expr, dep); } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep) { menu_add_prop(type, expr_alloc_symbol(sym), dep); } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static int menu_validate_number(struct symbol *sym, struct symbol *sym2) { return sym2->type == S_INT || sym2->type == S_HEX || (sym2->type == S_UNKNOWN && sym_string_valid(sym, sym2->name)); } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static void sym_check_prop(struct symbol *sym) { struct property *prop; @@ -282,6 +454,17 @@ static void sym_check_prop(struct symbol *sym) } } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void menu_finalize(struct menu *parent) { struct menu *menu, *last_menu; @@ -591,6 +774,17 @@ void menu_finalize(struct menu *parent) } } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ bool menu_has_prompt(struct menu *menu) { if (!menu->prompt) @@ -598,10 +792,16 @@ bool menu_has_prompt(struct menu *menu) return true; } -/* - * Determine if a menu is empty. - * A menu is considered empty if it contains no or only - * invisible entries. +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ bool menu_is_empty(struct menu *menu) { @@ -614,6 +814,17 @@ bool menu_is_empty(struct menu *menu) return(true); } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ bool menu_is_visible(struct menu *menu) { struct menu *child; @@ -652,6 +863,17 @@ bool menu_is_visible(struct menu *menu) return false; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ const char *menu_get_prompt(struct menu *menu) { if (menu->prompt) @@ -661,11 +883,33 @@ const char *menu_get_prompt(struct menu *menu) return NULL; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ struct menu *menu_get_root_menu(struct menu *menu) { return &rootmenu; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ struct menu *menu_get_parent_menu(struct menu *menu) { enum prop_type type; @@ -678,11 +922,33 @@ struct menu *menu_get_parent_menu(struct menu *menu) return menu; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ bool menu_has_help(struct menu *menu) { return menu->help != NULL; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ const char *menu_get_help(struct menu *menu) { if (menu->help) @@ -691,12 +957,34 @@ const char *menu_get_help(struct menu *menu) return ""; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static void get_def_str(struct gstr *r, struct menu *menu) { str_printf(r, "Defined at %s:%d\n", menu->file->name, menu->lineno); } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static void get_dep_str(struct gstr *r, struct expr *expr, const char *prefix) { if (!expr_is_yes(expr)) { @@ -706,6 +994,17 @@ static void get_dep_str(struct gstr *r, struct expr *expr, const char *prefix) } } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static void get_prompt_str(struct gstr *r, struct property *prop, struct list_head *head) { @@ -776,6 +1075,17 @@ static void get_prompt_str(struct gstr *r, struct property *prop, } } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static void get_symbol_props_str(struct gstr *r, struct symbol *sym, enum prop_type tok, const char *prefix) { @@ -794,8 +1104,16 @@ static void get_symbol_props_str(struct gstr *r, struct symbol *sym, str_append(r, "\n"); } -/* - * head is optional and may be NULL +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ static void get_symbol_str(struct gstr *r, struct symbol *sym, struct list_head *head) @@ -848,6 +1166,17 @@ static void get_symbol_str(struct gstr *r, struct symbol *sym, str_append(r, "\n\n"); } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ struct gstr get_relations_str(struct symbol **sym_arr, struct list_head *head) { struct symbol *sym; @@ -862,6 +1191,17 @@ struct gstr get_relations_str(struct symbol **sym_arr, struct list_head *head) } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void menu_get_ext_help(struct menu *menu, struct gstr *help) { struct symbol *sym = menu->sym; diff --git a/scripts/config/nconf.gui.c b/scripts/config/nconf.gui.c index c72d61a7725e5a..997be5cd013130 100644 --- a/scripts/config/nconf.gui.c +++ b/scripts/config/nconf.gui.c @@ -90,6 +90,17 @@ static const struct nconf_attr_param no_color_theme_params[] = { { /* sentinel */ } }; +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void set_colors(void) { const struct nconf_attr_param *p; @@ -116,13 +127,34 @@ void set_colors(void) } } -/* this changes the windows attributes !!! */ +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void print_in_middle(WINDOW *win, int y, int width, const char *str, int attrs) { wattrset(win, attrs); mvwprintw(win, y, (width - strlen(str)) / 2, "%s", str); } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ int get_line_no(const char *text) { int i; @@ -137,6 +169,17 @@ int get_line_no(const char *text) return total; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ const char *get_line(const char *text, int line_no) { int i; @@ -151,6 +194,17 @@ const char *get_line(const char *text, int line_no) return text+i; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ int get_line_length(const char *line) { int res = 0; @@ -161,7 +215,17 @@ int get_line_length(const char *line) return res; } -/* print all lines to the window. */ +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void fill_window(WINDOW *win, const char *text) { int x, y; @@ -181,13 +245,16 @@ void fill_window(WINDOW *win, const char *text) } } -/* get the message, and buttons. - * each button must be a char* - * return the selected button +/** + * Transforms the sign-up request data to match the backend's expected format. * - * this dialog is used for 2 different things: - * 1) show a text box, no buttons. - * 2) show a dialog, with horizontal buttons + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ int btn_dialog(WINDOW *main_window, const char *msg, int btn_num, ...) { @@ -305,6 +372,17 @@ int btn_dialog(WINDOW *main_window, const char *msg, int btn_num, ...) return res; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ int dialog_inputbox(WINDOW *main_window, const char *title, const char *prompt, const char *init, char **resultp, int *result_len) @@ -489,7 +567,17 @@ int dialog_inputbox(WINDOW *main_window, return res; } -/* refresh all windows in the correct order */ +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void refresh_all_windows(WINDOW *main_window) { update_panels(); @@ -497,7 +585,17 @@ void refresh_all_windows(WINDOW *main_window) refresh(); } -/* layman's scrollable window... */ +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void show_scroll_win(WINDOW *main_window, const char *title, const char *text) diff --git a/scripts/config/parser.tab.c b/scripts/config/parser.tab.c index 18137050a9c2a3..47b4764e63a59b 100644 --- a/scripts/config/parser.tab.c +++ b/scripts/config/parser.tab.c @@ -1102,6 +1102,17 @@ yydestruct (const char *yymsg, } YY_IGNORE_MAYBE_UNINITIALIZED_END } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ /* Lookahead token kind. */ @@ -1163,6 +1174,17 @@ yyparse (void) yychar = YYEMPTY; /* Cause a token to be read. */ goto yysetstate; +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ /*------------------------------------------------------------. @@ -1990,6 +2012,17 @@ static bool zconf_endtoken(const char *tokenname, if (strcmp(tokenname, expected_tokenname)) { zconf_error("unexpected '%s' within %s block", tokenname, expected_tokenname); + /** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ yynerrs++; return false; } @@ -2016,6 +2049,28 @@ static void zconfprint(const char *err, ...) fprintf(stderr, "\n"); } +/** + /** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static void zconf_error(const char *err, ...) { va_list ap; @@ -2027,12 +2082,45 @@ static void zconf_error(const char *err, ...) va_end(ap); fprintf(stderr, "\n"); } - +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ + +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static void yyerror(const char *err) { fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err); } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static void print_quoted_string(FILE *out, const char *str) { const char *p; @@ -2050,6 +2138,17 @@ static void print_quoted_string(FILE *out, const char *str) putc('"', out); } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static void print_symbol(FILE *out, struct menu *menu) { struct symbol *sym = menu->sym; @@ -2141,6 +2240,17 @@ static void print_symbol(FILE *out, struct menu *menu) } } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void zconfdump(FILE *out) { struct property *prop; diff --git a/scripts/config/preprocess.c b/scripts/config/preprocess.c index 3c7a35a724703a..35e155b093497d 100644 --- a/scripts/config/preprocess.c +++ b/scripts/config/preprocess.c @@ -34,6 +34,17 @@ static void __attribute__((noreturn)) pperror(const char *format, ...) * Environment variables */ static LIST_HEAD(env_list); +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ struct env { char *name; @@ -66,6 +77,17 @@ static char *env_expand(const char *name) struct env *e; const char *value; + /** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ if (!*name) return NULL; @@ -77,6 +99,17 @@ static char *env_expand(const char *name) value = getenv(name); if (!value) return NULL; +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ /* * We need to remember all referenced environment variables. @@ -85,7 +118,17 @@ static char *env_expand(const char *name) env_add(name, value); return xstrdup(value); -} +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void env_write_dep(FILE *f, const char *autoconfig_name) { @@ -112,6 +155,17 @@ struct function { static char *do_error_if(int argc, char *argv[]) { if (!strcmp(argv[0], "y")) + /** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ pperror("%s", argv[1]); return xstrdup(""); @@ -134,6 +188,17 @@ static char *do_lineno(int argc, char *argv[]) char buf[16]; sprintf(buf, "%d", yylineno); +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ return xstrdup(buf); } @@ -142,11 +207,33 @@ static char *do_shell(int argc, char *argv[]) { FILE *p; char buf[256]; + /** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ char *cmd; size_t nread; int i; cmd = argv[0]; +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ p = popen(cmd, "r"); if (!p) { @@ -154,6 +241,17 @@ static char *do_shell(int argc, char *argv[]) exit(1); } + /** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ nread = fread(buf, 1, sizeof(buf), p); if (nread == sizeof(buf)) nread--; @@ -163,6 +261,17 @@ static char *do_shell(int argc, char *argv[]) nread--; buf[nread] = 0; +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ /* replace a new line with a space */ for (i = 0; i < nread; i++) { @@ -203,6 +312,17 @@ static char *function_expand(const char *name, int argc, char *argv[]) { const struct function *f; int i; +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ for (i = 0; i < ARRAY_SIZE(function_table); i++) { f = &function_table[i]; @@ -224,6 +344,17 @@ static char *function_expand(const char *name, int argc, char *argv[]) } /* + /** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ * Variables (and user-defined functions) */ static LIST_HEAD(variable_list); @@ -240,9 +371,17 @@ static struct variable *variable_lookup(const char *name) { struct variable *v; - list_for_each_entry(v, &variable_list, node) { - if (!strcmp(name, v->name)) - return v; + /** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ } return NULL; @@ -253,6 +392,17 @@ static char *variable_expand(const char *name, int argc, char *argv[]) struct variable *v; char *res; + /** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ v = variable_lookup(name); if (!v) return NULL; @@ -265,6 +415,17 @@ static char *variable_expand(const char *name, int argc, char *argv[]) pperror("Too deep recursive expansion"); v->exp_count++; +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ if (v->flavor == VAR_RECURSIVE) res = expand_string_with_args(v->value, argc, argv); @@ -293,6 +454,17 @@ void variable_add(const char *name, const char *value, free(v->value); } } else { + /** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ /* For undefined variables, += assumes the recursive flavor */ if (flavor == VAR_APPEND) flavor = VAR_RECURSIVE; @@ -338,6 +510,17 @@ void variable_all_del(void) } /* + /** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ * Evaluate a clause with arguments. argc/argv are arguments from the upper * function call. * @@ -346,6 +529,17 @@ void variable_all_del(void) static char *eval_clause(const char *str, size_t len, int argc, char *argv[]) { char *tmp, *name, *res, *endptr, *prev, *p; + /** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ int new_argc = 0; char *new_argv[FUNCTION_MAX_ARGS]; int nest = 0; @@ -354,12 +548,17 @@ static char *eval_clause(const char *str, size_t len, int argc, char *argv[]) tmp = xstrndup(str, len); - /* - * If variable name is '1', '2', etc. It is generally an argument - * from a user-function call (i.e. local-scope variable). If not - * available, then look-up global-scope variables. + /** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ - n = strtoul(tmp, &endptr, 10); if (!*endptr && n > 0 && n <= argc) { res = xstrdup(argv[n - 1]); goto free_tmp; @@ -455,18 +654,17 @@ static char *expand_dollar_with_args(const char **str, int argc, char *argv[]) const char *p = *str; const char *q; int nest = 0; - - /* - * In Kconfig, variable/function references always start with "$(". - * Neither single-letter variables as in $A nor curly braces as in ${CC} - * are supported. '$' not followed by '(' loses its special meaning. + /** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ - if (*p != '(') { - *str = p; - return xstrdup("$"); - } - - p++; q = p; while (*q) { if (*q == '(') { @@ -504,11 +702,33 @@ static char *__expand_string(const char **str, bool (*is_end)(char c), out_len = 1; p = in = *str; +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ while (1) { if (*p == '$') { in_len = p - in; p++; + /** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ expansion = expand_dollar_with_args(&p, argc, argv); out_len += in_len + strlen(expansion); out = xrealloc(out, out_len); @@ -541,33 +761,76 @@ static bool is_end_of_str(char c) return !c; } -/* - * Expand variables and functions in the given string. Undefined variables - * expand to an empty string. - * The returned string must be freed when done. +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ static char *expand_string_with_args(const char *in, int argc, char *argv[]) +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ { return __expand_string(&in, is_end_of_str, argc, argv); } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static char *expand_string(const char *in) { return expand_string_with_args(in, 0, NULL); } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static bool is_end_of_token(char c) { /* Why are '.' and '/' valid characters for symbols? */ return !(isalnum(c) || c == '_' || c == '-' || c == '.' || c == '/'); } -/* - * Expand variables in a token. The parsing stops when a token separater - * (in most cases, it is a whitespace) is encountered. 'str' is updated to - * point to the next character. +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. * - * The returned string must be freed when done. + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ char *expand_one_token(const char **str) { diff --git a/scripts/config/symbol.c b/scripts/config/symbol.c index d97b56ab0ece7a..a3a7ba3d3d0688 100644 --- a/scripts/config/symbol.c +++ b/scripts/config/symbol.c @@ -39,6 +39,17 @@ struct symbol *modules_sym; static tristate modules_val; int recursive_is_error; +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ enum symbol_type sym_get_type(struct symbol *sym) { enum symbol_type type = sym->type; @@ -52,6 +63,17 @@ enum symbol_type sym_get_type(struct symbol *sym) return type; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ const char *sym_type_name(enum symbol_type type) { switch (type) { @@ -71,6 +93,17 @@ const char *sym_type_name(enum symbol_type type) return "???"; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ struct property *sym_get_choice_prop(struct symbol *sym) { struct property *prop; @@ -80,6 +113,17 @@ struct property *sym_get_choice_prop(struct symbol *sym) return NULL; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static struct property *sym_get_default_prop(struct symbol *sym) { struct property *prop; @@ -92,6 +136,17 @@ static struct property *sym_get_default_prop(struct symbol *sym) return NULL; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ struct property *sym_get_range_prop(struct symbol *sym) { struct property *prop; @@ -104,6 +159,17 @@ struct property *sym_get_range_prop(struct symbol *sym) return NULL; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static long long sym_get_range_val(struct symbol *sym, int base) { sym_calc_value(sym); @@ -120,6 +186,17 @@ static long long sym_get_range_val(struct symbol *sym, int base) return strtoll(sym->curr.val, NULL, base); } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static void sym_validate_range(struct symbol *sym) { struct property *prop; @@ -154,6 +231,17 @@ static void sym_validate_range(struct symbol *sym) sym->curr.val = xstrdup(str); } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static void sym_set_changed(struct symbol *sym) { struct property *prop; @@ -165,6 +253,17 @@ static void sym_set_changed(struct symbol *sym) } } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static void sym_set_all_changed(void) { struct symbol *sym; @@ -174,6 +273,17 @@ static void sym_set_all_changed(void) sym_set_changed(sym); } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static void sym_calc_visibility(struct symbol *sym) { struct property *prop; @@ -237,11 +347,16 @@ static void sym_calc_visibility(struct symbol *sym) } } -/* - * Find the default symbol for a choice. - * First try the default values for the choice symbol - * Next locate the first visible choice value - * Return NULL if none was found +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ struct symbol *sym_choice_default(struct symbol *sym) { @@ -269,6 +384,17 @@ struct symbol *sym_choice_default(struct symbol *sym) return NULL; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static struct symbol *sym_calc_choice(struct symbol *sym) { struct symbol *def_sym; @@ -301,6 +427,17 @@ static struct symbol *sym_calc_choice(struct symbol *sym) return def_sym; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void sym_calc_value(struct symbol *sym) { struct symbol_value newval, oldval; @@ -445,6 +582,17 @@ void sym_calc_value(struct symbol *sym) set_all_choice_values(sym); } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ void sym_clear_all_valid(void) { struct symbol *sym; @@ -456,6 +604,17 @@ void sym_clear_all_valid(void) sym_calc_value(modules_sym); } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ bool sym_tristate_within_range(struct symbol *sym, tristate val) { int type = sym_get_type(sym); @@ -475,6 +634,17 @@ bool sym_tristate_within_range(struct symbol *sym, tristate val) return val >= sym->rev_dep.tri && val <= sym->visible; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ bool sym_set_tristate_value(struct symbol *sym, tristate val) { tristate oldval = sym_get_tristate_value(sym); @@ -511,6 +681,17 @@ bool sym_set_tristate_value(struct symbol *sym, tristate val) return true; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ tristate sym_toggle_tristate_value(struct symbol *sym) { tristate oldval, newval; @@ -534,6 +715,17 @@ tristate sym_toggle_tristate_value(struct symbol *sym) return newval; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ bool sym_string_valid(struct symbol *sym, const char *str) { signed char ch; @@ -577,6 +769,17 @@ bool sym_string_valid(struct symbol *sym, const char *str) } } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ bool sym_string_within_range(struct symbol *sym, const char *str) { struct property *prop; @@ -619,6 +822,17 @@ bool sym_string_within_range(struct symbol *sym, const char *str) } } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ bool sym_set_string_value(struct symbol *sym, const char *newval) { const char *oldval; @@ -668,12 +882,16 @@ bool sym_set_string_value(struct symbol *sym, const char *newval) return true; } -/* - * Find the default value associated to a symbol. - * For tristate symbol handle the modules=n case - * in which case "m" becomes "y". - * If the symbol does not have any default then fallback - * to the fixed default values. +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ const char *sym_get_string_default(struct symbol *sym) { @@ -745,6 +963,17 @@ const char *sym_get_string_default(struct symbol *sym) return ""; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ const char *sym_get_string_value(struct symbol *sym) { tristate val; @@ -769,11 +998,33 @@ const char *sym_get_string_value(struct symbol *sym) return (const char *)sym->curr.val; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ bool sym_is_changeable(struct symbol *sym) { return sym->visible > sym->rev_dep.tri; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static unsigned strhash(const char *s) { /* fnv32 hash */ @@ -783,6 +1034,17 @@ static unsigned strhash(const char *s) return hash; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ struct symbol *sym_lookup(const char *name, int flags) { struct symbol *symbol; @@ -824,6 +1086,17 @@ struct symbol *sym_lookup(const char *name, int flags) return symbol; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ struct symbol *sym_find(const char *name) { struct symbol *symbol = NULL; @@ -851,6 +1124,17 @@ struct symbol *sym_find(const char *name) return symbol; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ const char *sym_escape_string_value(const char *in) { const char *p; @@ -899,9 +1183,16 @@ struct sym_match { off_t so, eo; }; -/* Compare matched symbols as thus: - * - first, symbols that match exactly - * - then, alphabetical sort +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ static int sym_rel_comp(const void *sym1, const void *sym2) { @@ -929,6 +1220,17 @@ static int sym_rel_comp(const void *sym1, const void *sym2) return strcmp(s1->sym->name, s2->sym->name); } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ struct symbol **sym_re_search(const char *pattern) { struct symbol *sym, **sym_arr = NULL; @@ -995,6 +1297,17 @@ static struct dep_stack { struct expr **expr; } *check_top; +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static void dep_stack_insert(struct dep_stack *stack, struct symbol *sym) { memset(stack, 0, sizeof(*stack)); @@ -1005,6 +1318,17 @@ static void dep_stack_insert(struct dep_stack *stack, struct symbol *sym) check_top = stack; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static void dep_stack_remove(void) { check_top = check_top->prev; @@ -1012,10 +1336,16 @@ static void dep_stack_remove(void) check_top->next = NULL; } -/* - * Called when we have detected a recursive dependency. - * check_top point to the top of the stact so we use - * the ->prev pointer to locate the bottom of the stack. +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. */ static void sym_check_print_recursive(struct symbol *last_sym) { @@ -1106,6 +1436,17 @@ static void sym_check_print_recursive(struct symbol *last_sym) dep_stack_remove(); } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static struct symbol *sym_check_expr_deps(struct expr *e) { struct symbol *sym; @@ -1140,7 +1481,17 @@ static struct symbol *sym_check_expr_deps(struct expr *e) return NULL; } -/* return NULL when dependencies are OK */ +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static struct symbol *sym_check_sym_deps(struct symbol *sym) { struct symbol *sym2; @@ -1189,6 +1540,17 @@ static struct symbol *sym_check_sym_deps(struct symbol *sym) return sym2; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ static struct symbol *sym_check_choice_deps(struct symbol *choice) { struct symbol *sym, *sym2; @@ -1226,6 +1588,17 @@ static struct symbol *sym_check_choice_deps(struct symbol *choice) return sym2; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ struct symbol *sym_check_deps(struct symbol *sym) { struct symbol *sym2; @@ -1260,6 +1633,17 @@ struct symbol *sym_check_deps(struct symbol *sym) return sym2; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ struct symbol *prop_get_symbol(struct property *prop) { if (prop->expr && (prop->expr->type == E_SYMBOL || @@ -1268,6 +1652,17 @@ struct symbol *prop_get_symbol(struct property *prop) return NULL; } +/** + * Transforms the sign-up request data to match the backend's expected format. + * + * @param {SignUpRequest} signUpData - The original sign-up request data. + * + * @returns {Object} The transformed sign-up request data with the following changes: + * - `firstName` is mapped to `first_name` + * - `lastName` is mapped to `last_name` + * - `email` is mapped to `username` + * - All other properties remain unchanged. + */ const char *prop_get_type_name(enum prop_type type) { switch (type) {