summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandroColomar <colomar.6.4.3@gmail.com>2019-01-05 02:19:38 +0100
committerAlejandroColomar <colomar.6.4.3@gmail.com>2019-01-05 02:19:38 +0100
commitbf7153d5b03c62774191368d7369543465923b41 (patch)
tree92408b54a57bf7c56180bbdf85bc603a9b80f548
parenta2a35556975685315d8cc154ce627da58b385e3a (diff)
Fix style (kernel checkstyle)
m---------libalx0
-rw-r--r--modules/about/inc/about.h11
-rw-r--r--modules/about/inc/about.hpp11
-rw-r--r--modules/about/src/about.c19
-rw-r--r--modules/ctrl/inc/start.h1
-rw-r--r--modules/ctrl/src/start.c5
-rw-r--r--modules/image/inc/img_alx.hpp1
-rw-r--r--modules/image/inc/img_calib3d.hpp3
-rw-r--r--modules/image/inc/img_cv.hpp1
-rw-r--r--modules/image/inc/img_iface.h28
-rw-r--r--modules/image/inc/img_iface.hpp19
-rw-r--r--modules/image/inc/img_ocr.h1
-rw-r--r--modules/image/inc/img_ocr.hpp3
-rw-r--r--modules/image/inc/img_orb.hpp5
-rw-r--r--modules/image/inc/img_zbar.hpp1
-rw-r--r--modules/image/src/img_calib3d.cpp1
-rw-r--r--modules/image/src/img_cv.cpp1
-rw-r--r--modules/image/src/img_iface.cpp3
-rw-r--r--modules/image/src/img_ocr.c22
-rw-r--r--modules/image/src/img_orb.cpp1
-rw-r--r--modules/image/src/img_zbar.cpp1
-rw-r--r--modules/menu/inc/menu_clui.h3
-rw-r--r--modules/menu/inc/menu_iface.h1
-rw-r--r--modules/menu/inc/menu_iface.hpp5
-rw-r--r--modules/menu/inc/menu_tui.h3
-rw-r--r--modules/menu/inc/parser.h1
-rw-r--r--modules/menu/inc/parser.hpp3
-rw-r--r--modules/menu/src/menu_clui.c39
-rw-r--r--modules/menu/src/menu_iface.c1
-rw-r--r--modules/menu/src/menu_tui.c68
-rw-r--r--modules/menu/src/parser.c19
-rw-r--r--modules/proc/inc/proc_coins.h3
-rw-r--r--modules/proc/inc/proc_coins.hpp3
-rw-r--r--modules/proc/inc/proc_common.h7
-rw-r--r--modules/proc/inc/proc_common.hpp1
-rw-r--r--modules/proc/inc/proc_iface.h9
-rw-r--r--modules/proc/inc/proc_iface.hpp9
-rw-r--r--modules/proc/inc/proc_label.h3
-rw-r--r--modules/proc/inc/proc_label.hpp3
-rw-r--r--modules/proc/inc/proc_lighters.h3
-rw-r--r--modules/proc/inc/proc_lighters.hpp3
-rw-r--r--modules/proc/inc/proc_objects.h5
-rw-r--r--modules/proc/inc/proc_objects.hpp5
-rw-r--r--modules/proc/inc/proc_resistor.h3
-rw-r--r--modules/proc/inc/proc_resistor.hpp3
-rw-r--r--modules/proc/src/proc_coins.cpp1
-rw-r--r--modules/proc/src/proc_common.cpp1
-rw-r--r--modules/proc/src/proc_iface.c1
-rw-r--r--modules/proc/src/proc_label.cpp1
-rw-r--r--modules/proc/src/proc_lighters.cpp1
-rw-r--r--modules/proc/src/proc_objects.cpp1
-rw-r--r--modules/proc/src/proc_resistor.cpp1
-rw-r--r--modules/save/inc/save.h39
-rw-r--r--modules/save/inc/save.hpp41
-rw-r--r--modules/save/src/save.cpp1
-rw-r--r--modules/user/inc/user_clui.h1
-rw-r--r--modules/user/inc/user_iface.h23
-rw-r--r--modules/user/inc/user_iface.hpp23
-rw-r--r--modules/user/inc/user_tui.h1
-rw-r--r--modules/user/src/user_clui.c14
-rw-r--r--modules/user/src/user_iface.c9
-rw-r--r--modules/user/src/user_tui.c51
-rw-r--r--src/main.cpp1
63 files changed, 328 insertions, 224 deletions
diff --git a/libalx b/libalx
-Subproject 0e3f07b6d3894c494f39d63c1c617b6600d6521
+Subproject e67da562ef5e2dda524c86da3367d537caee4d4
diff --git a/modules/about/inc/about.h b/modules/about/inc/about.h
index 62a0963..381f13d 100644
--- a/modules/about/inc/about.h
+++ b/modules/about/inc/about.h
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
@@ -40,16 +41,16 @@
/******************************************************************************
******* variables ************************************************************
******************************************************************************/
- extern char share_path [FILENAME_MAX];
+extern char share_path [FILENAME_MAX];
/******************************************************************************
******* functions ************************************************************
******************************************************************************/
- void about_init (void);
- void snprint_share_file (char *dest, int destsize, int share_file);
- void print_share_file (int share_file);
- void print_version (void);
+void about_init (void);
+void snprint_share_file (char *dest, int destsize, int share_file);
+void print_share_file (int share_file);
+void print_version (void);
/******************************************************************************
diff --git a/modules/about/inc/about.hpp b/modules/about/inc/about.hpp
index a1a9f2e..31d5977 100644
--- a/modules/about/inc/about.hpp
+++ b/modules/about/inc/about.hpp
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
@@ -46,16 +47,16 @@ extern "C" {
/******************************************************************************
******* variables ************************************************************
******************************************************************************/
- extern char share_path [FILENAME_MAX];
+extern char share_path [FILENAME_MAX];
/******************************************************************************
******* functions ************************************************************
******************************************************************************/
- void about_init (void);
- void snprint_share_file (char *dest, int destsize, int share_file);
- void print_share_file (int share_file);
- void print_version (void);
+void about_init (void);
+void snprint_share_file (char *dest, int destsize, int share_file);
+void print_share_file (int share_file);
+void print_version (void);
/******************************************************************************
diff --git a/modules/about/src/about.c b/modules/about/src/about.c
index a9561e0..daae65a 100644
--- a/modules/about/src/about.c
+++ b/modules/about/src/about.c
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
@@ -38,7 +39,8 @@ char share_path [FILENAME_MAX];
******************************************************************************/
void about_init (void)
{
- snprintf(share_path, FILENAME_MAX, "%s/%s/", INSTALL_SHARE_DIR, SHARE_DIR);
+ snprintf(share_path, FILENAME_MAX, "%s/%s/",
+ INSTALL_SHARE_DIR, SHARE_DIR);
}
void snprint_share_file (char *dest, int destsize, int share_file)
@@ -47,19 +49,24 @@ void snprint_share_file (char *dest, int destsize, int share_file)
switch (share_file) {
case SHARE_COPYRIGHT:
- snprintf(file_name, FILENAME_MAX, "%s/%s", share_path, "COPYRIGHT.txt");
+ snprintf(file_name, FILENAME_MAX, "%s/%s",
+ share_path, "COPYRIGHT.txt");
break;
case SHARE_DISCLAIMER:
- snprintf(file_name, FILENAME_MAX, "%s/%s", share_path, "DISCLAIMER.txt");
+ snprintf(file_name, FILENAME_MAX, "%s/%s",
+ share_path, "DISCLAIMER.txt");
break;
case SHARE_HELP:
- snprintf(file_name, FILENAME_MAX, "%s/%s", share_path, "HELP.txt");
+ snprintf(file_name, FILENAME_MAX, "%s/%s",
+ share_path, "HELP.txt");
break;
case SHARE_LICENSE:
- snprintf(file_name, FILENAME_MAX, "%s/%s", share_path, "LICENSE.txt");
+ snprintf(file_name, FILENAME_MAX, "%s/%s",
+ share_path, "LICENSE.txt");
break;
case SHARE_USAGE:
- snprintf(file_name, FILENAME_MAX, "%s/%s", share_path, "USAGE.txt");
+ snprintf(file_name, FILENAME_MAX, "%s/%s",
+ share_path, "USAGE.txt");
break;
}
diff --git a/modules/ctrl/inc/start.h b/modules/ctrl/inc/start.h
index 1ef2af6..e8273f1 100644
--- a/modules/ctrl/inc/start.h
+++ b/modules/ctrl/inc/start.h
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
diff --git a/modules/ctrl/src/start.c b/modules/ctrl/src/start.c
index 37ea1b4..2022b32 100644
--- a/modules/ctrl/src/start.c
+++ b/modules/ctrl/src/start.c
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
@@ -46,6 +47,7 @@ static void start_series (void);
******************************************************************************/
void start_switch (void)
{
+
switch (start_mode) {
case START_FOO:
start_foo();
@@ -67,11 +69,13 @@ void start_switch (void)
******************************************************************************/
static void start_foo (void)
{
+
/* empty */
}
static void start_single (void)
{
+
errno = 0;
img_iface_load(NULL, saved_name);
@@ -89,6 +93,7 @@ static void start_single (void)
static void start_series (void)
{
int tmp;
+
tmp = user_iface_mode;
user_iface_mode = USER_IFACE_CLUI;
diff --git a/modules/image/inc/img_alx.hpp b/modules/image/inc/img_alx.hpp
index d3867d6..6eb76ce 100644
--- a/modules/image/inc/img_alx.hpp
+++ b/modules/image/inc/img_alx.hpp
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
diff --git a/modules/image/inc/img_calib3d.hpp b/modules/image/inc/img_calib3d.hpp
index 7079d68..87ff946 100644
--- a/modules/image/inc/img_calib3d.hpp
+++ b/modules/image/inc/img_calib3d.hpp
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
@@ -32,7 +33,7 @@
/******************************************************************************
******* functions ************************************************************
******************************************************************************/
- void img_calib3d_act (class cv::Mat *imgptr, int action, void *data);
+void img_calib3d_act (class cv::Mat *imgptr, int action, void *data);
/******************************************************************************
diff --git a/modules/image/inc/img_cv.hpp b/modules/image/inc/img_cv.hpp
index 61cb78a..f1aa538 100644
--- a/modules/image/inc/img_cv.hpp
+++ b/modules/image/inc/img_cv.hpp
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
diff --git a/modules/image/inc/img_iface.h b/modules/image/inc/img_iface.h
index 460db47..c071971 100644
--- a/modules/image/inc/img_iface.h
+++ b/modules/image/inc/img_iface.h
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
@@ -29,10 +30,7 @@
# define IMG_IFACE_THR_OTSU (-1)
/* Functions -----------------------------------------------------------------*/
- # define img_iface_act_nodata(x) \
- do { \
- img_iface_act(x, NULL); \
- } while (0)
+ # define img_iface_act_nodata(x) img_iface_act(x, NULL)
/******************************************************************************
@@ -160,20 +158,20 @@
/******************************************************************************
******* variables ************************************************************
******************************************************************************/
- extern char img_ocr_text [OCR_TEXT_MAX];
- extern struct Img_Iface_ZB_Codes zb_codes;
+extern char img_ocr_text [OCR_TEXT_MAX];
+extern struct Img_Iface_ZB_Codes zb_codes;
/******************************************************************************
- ******* functions ************************************************************
- ******************************************************************************/
- void img_iface_cleanup_main (void);
- void img_iface_load (const char *fpath, const char *fname);
- void img_iface_cleanup (void);
- void img_iface_act (int action, void *data);
- void img_iface_show_img (void);
- void img_iface_show_hist_c1 (void);
- void img_iface_show_hist_c3 (void);
+******* functions ************************************************************
+******************************************************************************/
+void img_iface_cleanup_main (void);
+void img_iface_load (const char *fpath, const char *fname);
+void img_iface_cleanup (void);
+void img_iface_act (int action, void *data);
+void img_iface_show_img (void);
+void img_iface_show_hist_c1 (void);
+void img_iface_show_hist_c3 (void);
/******************************************************************************
diff --git a/modules/image/inc/img_iface.hpp b/modules/image/inc/img_iface.hpp
index 6448578..b1904df 100644
--- a/modules/image/inc/img_iface.hpp
+++ b/modules/image/inc/img_iface.hpp
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
@@ -310,20 +311,20 @@ extern "C" {
/******************************************************************************
******* variables ************************************************************
******************************************************************************/
- extern char img_ocr_text [OCR_TEXT_MAX];
- extern struct Img_Iface_ZB_Codes zb_codes;
+extern char img_ocr_text [OCR_TEXT_MAX];
+extern struct Img_Iface_ZB_Codes zb_codes;
/******************************************************************************
******* functions ************************************************************
******************************************************************************/
- void img_iface_cleanup_main (void);
- void img_iface_load (const char *fpath, const char *fname);
- void img_iface_cleanup (void);
- void img_iface_act (int action, void *data);
- void img_iface_show_img (void);
- void img_iface_show_hist_c1 (void);
- void img_iface_show_hist_c3 (void);
+void img_iface_cleanup_main (void);
+void img_iface_load (const char *fpath, const char *fname);
+void img_iface_cleanup (void);
+void img_iface_act (int action, void *data);
+void img_iface_show_img (void);
+void img_iface_show_hist_c1 (void);
+void img_iface_show_hist_c3 (void);
/******************************************************************************
diff --git a/modules/image/inc/img_ocr.h b/modules/image/inc/img_ocr.h
index 62d248a..e6c1bca 100644
--- a/modules/image/inc/img_ocr.h
+++ b/modules/image/inc/img_ocr.h
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
diff --git a/modules/image/inc/img_ocr.hpp b/modules/image/inc/img_ocr.hpp
index 355a124..dfd759a 100644
--- a/modules/image/inc/img_ocr.hpp
+++ b/modules/image/inc/img_ocr.hpp
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
@@ -30,7 +31,7 @@ extern "C" {
/******************************************************************************
******* functions ************************************************************
******************************************************************************/
- void img_ocr_act (int action, void *data);
+void img_ocr_act (int action, void *data);
/******************************************************************************
diff --git a/modules/image/inc/img_orb.hpp b/modules/image/inc/img_orb.hpp
index ce5a914..18db3a7 100644
--- a/modules/image/inc/img_orb.hpp
+++ b/modules/image/inc/img_orb.hpp
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
@@ -31,8 +32,8 @@
/******************************************************************************
******* functions ************************************************************
******************************************************************************/
- void img_orb_act (class cv::Mat *pattern,
- class cv::Mat *imgptr, int action);
+void img_orb_act (class cv::Mat *pattern,
+ class cv::Mat *imgptr, int action);
/******************************************************************************
diff --git a/modules/image/inc/img_zbar.hpp b/modules/image/inc/img_zbar.hpp
index 72f1020..d638ed5 100644
--- a/modules/image/inc/img_zbar.hpp
+++ b/modules/image/inc/img_zbar.hpp
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
diff --git a/modules/image/src/img_calib3d.cpp b/modules/image/src/img_calib3d.cpp
index 63a64f4..8aaa408 100644
--- a/modules/image/src/img_calib3d.cpp
+++ b/modules/image/src/img_calib3d.cpp
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
diff --git a/modules/image/src/img_cv.cpp b/modules/image/src/img_cv.cpp
index 0d76bb8..d9c2343 100644
--- a/modules/image/src/img_cv.cpp
+++ b/modules/image/src/img_cv.cpp
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
diff --git a/modules/image/src/img_iface.cpp b/modules/image/src/img_iface.cpp
index 0c896f6..6c5d64e 100644
--- a/modules/image/src/img_iface.cpp
+++ b/modules/image/src/img_iface.cpp
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
@@ -757,7 +758,7 @@ static void img_iface_set_ROI (void *data)
title, NULL);
snprintf(title, 80, "Width:");
- data_tmp.rect.width = user_iface_getint(1,
+ data_tmp.rect.width = user_iface_getint(1,
image_copy_tmp.cols - data_tmp.rect.x,
image_copy_tmp.cols - data_tmp.rect.x,
title, NULL);
diff --git a/modules/image/src/img_ocr.c b/modules/image/src/img_ocr.c
index c406abf..35e0db3 100644
--- a/modules/image/src/img_ocr.c
+++ b/modules/image/src/img_ocr.c
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
@@ -52,15 +53,18 @@ void img_ocr_act (int action, void *data)
******************************************************************************/
static void img_ocr_read (void *data)
{
- struct TessBaseAPI *handle_ocr;
+ struct Img_Iface_Data_Read *data_cast;
+ struct TessBaseAPI *handle_ocr;
+ int lang;
+ char lang_str [20 + 1];
+ int conf;
+ char conf_str [FILENAME_MAX];
+ char *txt;
/* Data */
- struct Img_Iface_Data_Read *data_cast;
data_cast = (struct Img_Iface_Data_Read *)data;
/* Language */
- int lang;
- char lang_str [20 + 1];
lang = data_cast->lang;
switch (lang) {
case IMG_IFACE_OCR_LANG_ENG:
@@ -81,8 +85,6 @@ static void img_ocr_read (void *data)
}
/* Config file */
- int conf;
- char conf_str [FILENAME_MAX];
conf = data_cast->conf;
switch (conf) {
case IMG_IFACE_OCR_CONF_PRICE:
@@ -92,13 +94,12 @@ static void img_ocr_read (void *data)
/* init OCR */
handle_ocr = TessBaseAPICreate();
- TessBaseAPIInit2(handle_ocr, NULL, lang_str,
#ifdef OEM_LSTM_ONLY
- OEM_LSTM_ONLY);
+ TessBaseAPIInit2(handle_ocr, NULL, lang_str, OEM_LSTM_ONLY);
#else
- OEM_DEFAULT);
+ TessBaseAPIInit2(handle_ocr, NULL, lang_str, OEM_DEFAULT);
#endif
-// OEM_TESSERACT_LSTM_COMBINED);
+/* TessBaseAPIInit2(handle_ocr, NULL, lang_str, OEM_TESSERACT_LSTM_COMBINED);*/
if (conf) {
/* Configure OCR (whitelist chars) */
TessBaseAPIReadConfigFile(handle_ocr, conf_str);
@@ -110,7 +111,6 @@ static void img_ocr_read (void *data)
data_cast->img.B_per_pix,
data_cast->img.B_per_line);
TessBaseAPIRecognize(handle_ocr, NULL);
- char *txt;
txt = TessBaseAPIGetUTF8Text(handle_ocr);
/* Copy text to global variable */
diff --git a/modules/image/src/img_orb.cpp b/modules/image/src/img_orb.cpp
index 6d91085..113f3dd 100644
--- a/modules/image/src/img_orb.cpp
+++ b/modules/image/src/img_orb.cpp
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
diff --git a/modules/image/src/img_zbar.cpp b/modules/image/src/img_zbar.cpp
index 5a976a6..fe2b669 100644
--- a/modules/image/src/img_zbar.cpp
+++ b/modules/image/src/img_zbar.cpp
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
diff --git a/modules/menu/inc/menu_clui.h b/modules/menu/inc/menu_clui.h
index 49de943..a915645 100644
--- a/modules/menu/inc/menu_clui.h
+++ b/modules/menu/inc/menu_clui.h
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
@@ -13,7 +14,7 @@
/******************************************************************************
******* functions ************************************************************
******************************************************************************/
- void menu_clui (void);
+void menu_clui (void);
/******************************************************************************
diff --git a/modules/menu/inc/menu_iface.h b/modules/menu/inc/menu_iface.h
index 09a1164..1b76e0b 100644
--- a/modules/menu/inc/menu_iface.h
+++ b/modules/menu/inc/menu_iface.h
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
diff --git a/modules/menu/inc/menu_iface.hpp b/modules/menu/inc/menu_iface.hpp
index 1b5b60c..6128711 100644
--- a/modules/menu/inc/menu_iface.hpp
+++ b/modules/menu/inc/menu_iface.hpp
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
@@ -29,13 +30,13 @@ extern "C" {
/******************************************************************************
******* variables ************************************************************
******************************************************************************/
- extern int menu_iface_mode;
+extern int menu_iface_mode;
/******************************************************************************
******* functions ************************************************************
******************************************************************************/
- void menu_iface (void);
+void menu_iface (void);
/******************************************************************************
diff --git a/modules/menu/inc/menu_tui.h b/modules/menu/inc/menu_tui.h
index 74cfd5f..0f8e442 100644
--- a/modules/menu/inc/menu_tui.h
+++ b/modules/menu/inc/menu_tui.h
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
@@ -13,7 +14,7 @@
/******************************************************************************
******* functions ************************************************************
******************************************************************************/
- void menu_tui (void);
+void menu_tui (void);
/******************************************************************************
diff --git a/modules/menu/inc/parser.h b/modules/menu/inc/parser.h
index a29afcd..3843017 100644
--- a/modules/menu/inc/parser.h
+++ b/modules/menu/inc/parser.h
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
diff --git a/modules/menu/inc/parser.hpp b/modules/menu/inc/parser.hpp
index 700a0aa..e40bbd3 100644
--- a/modules/menu/inc/parser.hpp
+++ b/modules/menu/inc/parser.hpp
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
@@ -19,7 +20,7 @@ extern "C" {
/******************************************************************************
******* functions ************************************************************
******************************************************************************/
- void parser (int argc, char *argv[]);
+void parser (int argc, char *argv[]);
/******************************************************************************
diff --git a/modules/menu/src/menu_clui.c b/modules/menu/src/menu_clui.c
index db2a11e..f5bb045 100644
--- a/modules/menu/src/menu_clui.c
+++ b/modules/menu/src/menu_clui.c
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
@@ -42,32 +43,38 @@ void menu_clui (void)
ch = 'n';
printf("Read 'Disclaimer of warranty'? (yes/NO): ");
fgets(buff, BUFF_SIZE, stdin);
- sscanf(buff, " %c", &ch);
+ if (sscanf(buff, " %c", &ch)) {
+ return;
+ }
if (ch == 'y' || ch == 'Y') {
- puts (" >yes");
+ printf(" >yes\n");
print_share_file(SHARE_DISCLAIMER);
} else {
- puts (" >NO");
+ printf(" >NO\n");
}
ch = 'n';
printf("Read 'License'? (yes/NO): ");
fgets(buff, BUFF_SIZE, stdin);
- sscanf(buff, " %c", &ch);
+ if (sscanf(buff, " %c", &ch)) {
+ return;
+ }
if (ch == 'y' || ch == 'Y') {
- puts (" >yes");
+ printf(" >yes\n");
print_share_file(SHARE_LICENSE);
} else {
- puts (" >NO");
+ printf(" >NO\n");
}
#if 0
printf("Game interface? (NCURSES/text): ");
- scanf(" %c%*s ", &ch);
+ if (sscanf(buff, " %c", &ch)) {
+ return;
+ }
if (ch == 't' || ch == 'T') {
- puts (" >text");
+ printf(" >text\n");
// FIXME
} else {
- puts (" >NCURSES");
+ printf(" >NCURSES\n");
// FIXME
}
#endif
@@ -81,7 +88,7 @@ void menu_clui (void)
static void menu_clui_load (void)
{
#if 0
- /* File name */ // FIXME
+ /* File name */ /* FIXME */
alx_w_getfname(USER_SAVED_DIR, saved_name, "File name:", saved_name, NULL);
#endif
menu_clui_start();
@@ -89,7 +96,7 @@ static void menu_clui_load (void)
static void menu_clui_start (void)
{
- puts(" >>START:");
+ printf(" >>START:\n");
start_switch();
char buff [BUFF_SIZE];
@@ -98,14 +105,16 @@ static void menu_clui_start (void)
ch = 'm';
printf("Load again? (MENU/load/exit): ");
fgets(buff, BUFF_SIZE, stdin);
- sscanf(buff, " %c", &ch);
+ if (sscanf(buff, " %c", &ch)) {
+ return;
+ }
if (ch == 'p' || ch == 'P') {
- puts (" >load");
+ printf(" >load\n");
menu_clui_start();
} else if (ch == 'e' || ch == 'E') {
- puts (" >exit!");
+ printf(" >exit!\n");
} else {
- puts (" >MENU");
+ printf(" >MENU\n");
menu_clui();
}
}
diff --git a/modules/menu/src/menu_iface.c b/modules/menu/src/menu_iface.c
index 03b1413..384fa35 100644
--- a/modules/menu/src/menu_iface.c
+++ b/modules/menu/src/menu_iface.c
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
diff --git a/modules/menu/src/menu_tui.c b/modules/menu/src/menu_tui.c
index fd760cf..5654b40 100644
--- a/modules/menu/src/menu_tui.c
+++ b/modules/menu/src/menu_tui.c
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
@@ -44,16 +45,19 @@ static void menu_tui_devel (void);
******************************************************************************/
void menu_tui (void)
{
+ int h;
+ int w;
+ int N;
+ bool wh;
+ int sw;
+
alx_resume_curses();
/* Menu dimensions & options */
- int h;
- int w;
h = 23;
w = 80;
- int N;
N = 4;
- struct Alx_Menu mnu[4] = {
+ static const struct Alx_Menu mnu[4] = {
{7, 4, "[0] Exit program"},
{2, 4, "[1] Continue"},
{4, 4, "[2] Disclaimer of warranty"},
@@ -61,8 +65,6 @@ void menu_tui (void)
};
/* Menu */
- bool wh;
- int sw;
wh = true;
while (wh) {
/* Menu loop */
@@ -103,19 +105,24 @@ void menu_tui (void)
******************************************************************************/
static void menu_tui_continue (void)
{
- /* Menu dimensions & options */
WINDOW *win;
int h;
int w;
int r;
int c;
+ int N;
+ int w2;
+ int r2;
+ bool wh;
+ int sw;
+
+ /* Menu dimensions & options */
h = 23;
w = 80;
r = 1;
c = (80 - w) / 2;
- int N;
N = 6;
- struct Alx_Menu mnu[6] = {
+ static const struct Alx_Menu mnu[6] = {
{8, 4, "[0] Back"},
{2, 4, "[1] Start"},
{3, 4, "[2] Select"},
@@ -125,15 +132,11 @@ static void menu_tui_continue (void)
};
/* Input box */
- int w2;
- int r2;
w2 = w - 8;
r2 = r + h - 5;
- char *txt[] = {"File name:"};
+ static const char *txt[] = {"File name:"};
/* Menu */
- bool wh;
- int sw;
wh = true;
while (wh) {
/* Menu loop */
@@ -186,21 +189,22 @@ static void menu_tui_continue (void)
static void menu_tui_select (void)
{
- /* Menu dimensions & options */
int h;
int w;
+ int N;
+ int sw;
+
+ /* Menu dimensions & options */
h = 23;
w = 80;
- int N;
N = 3;
- struct Alx_Menu mnu[3] = {
+ static const struct Alx_Menu mnu[3] = {
{6, 4, "[0] Back"},
{2, 4, "[1] Single image"},
{4, 4, "[2] Series"}
};
/* Menu loop */
- int sw;
sw = alx_menu(h, w, N, mnu, "SELECT MODE:");
/* Selection */
@@ -218,14 +222,16 @@ static void menu_tui_select (void)
static void menu_tui_series (void)
{
- /* Menu dimensions & options */
int h;
int w;
+ int N;
+ int sw;
+
+ /* Menu dimensions & options */
h = 23;
w = 80;
- int N;
N = 6;
- struct Alx_Menu mnu[6] = {
+ static const struct Alx_Menu mnu[6] = {
{8, 4, "[0] Back"},
{2, 4, "[1] Label"},
{3, 4, "[2] Objects"},
@@ -235,7 +241,6 @@ static void menu_tui_series (void)
};
/* Menu loop */
- int sw;
sw = alx_menu(h, w, N, mnu, "SELECT LEVEL:");
/* Selection */
@@ -266,13 +271,18 @@ static void menu_tui_devel (void)
int w;
int r;
int c;
+ int N;
+ int w2;
+ int r2;
+ bool wh;
+ int sw;
+
h = 23;
w = 80;
r = 1;
c = (80 - w) / 2;
- int N;
N = 4;
- struct Alx_Menu mnu[4] = {
+ static const struct Alx_Menu mnu[4] = {
{6, 4, "[0] Back"},
{2, 4, "[1] Change process mode"},
{3, 4, "[2] Change log mode"},
@@ -280,11 +290,9 @@ static void menu_tui_devel (void)
};
/* Input box */
- int w2;
- int r2;
w2 = w - 8;
r2 = r + h - 5;
- char *txt[] = {
+ static const char *txt[] = {
"Modes: 0=Auto; 1=Stop@prod; 2=Delay@step; 3=Stop@step",
"Modes: 0=Results; 1=Operations; 2=All",
"Modes: 1=CLUI; 2=TUI"
@@ -294,8 +302,6 @@ static void menu_tui_devel (void)
win = newwin(h, w, r, c);
/* Menu loop */
- bool wh;
- int sw;
wh = true;
while (wh) {
/* Selection */
@@ -308,8 +314,8 @@ static void menu_tui_devel (void)
case 1:
proc_debug = alx_w_getint(w2, r2, txt[0],
- PROC_DBG_NO, 0, PROC_DBG_STOP_STEP,
- NULL);
+ PROC_DBG_NO, 0,
+ PROC_DBG_STOP_STEP, NULL);
break;
case 2:
diff --git a/modules/menu/src/parser.c b/modules/menu/src/parser.c
index ef8cec9..d9faaf6 100644
--- a/modules/menu/src/parser.c
+++ b/modules/menu/src/parser.c
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
@@ -37,8 +38,8 @@
/******************************************************************************
******* static functions *****************************************************
******************************************************************************/
-static void parse_file (char* argument);
-static void parse_iface (char* argument);
+static void parse_file (char *argument);
+static void parse_iface (char *argument);
/******************************************************************************
@@ -106,10 +107,11 @@ void parser (int argc, char *argv[])
/******************************************************************************
******* static functions *****************************************************
******************************************************************************/
-static void parse_file (char* argument)
+static void parse_file (char *argument)
{
- // FIXME
FILE *fp;
+
+ /* FIXME */
fp = fopen(argument, "r");
if (!fp) {
printf("--file argument not valid\n");
@@ -123,13 +125,16 @@ static void parse_file (char* argument)
}
}
-static void parse_iface (char* argument)
+static void parse_iface (char *argument)
{
+
menu_iface_mode = atoi(argument);
user_iface_mode = menu_iface_mode;
- if (menu_iface_mode < MENU_IFACE_CLUI || menu_iface_mode > MENU_IFACE_TUI) {
+ if ((menu_iface_mode < MENU_IFACE_CLUI) ||
+ (menu_iface_mode > MENU_IFACE_TUI)) {
printf("--iface argument not valid\n");
- printf("It must be an integer [%i U %i]\n", MENU_IFACE_CLUI, MENU_IFACE_TUI);
+ printf("It must be an integer [%i U %i]\n",
+ MENU_IFACE_CLUI, MENU_IFACE_TUI);
exit(EXIT_FAILURE);
}
}
diff --git a/modules/proc/inc/proc_coins.h b/modules/proc/inc/proc_coins.h
index 7e29d7d..0052eb2 100644
--- a/modules/proc/inc/proc_coins.h
+++ b/modules/proc/inc/proc_coins.h
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
@@ -34,7 +35,7 @@
/******************************************************************************
******* functions ************************************************************
******************************************************************************/
- int proc_coins (void);
+int proc_coins (void);
/******************************************************************************
diff --git a/modules/proc/inc/proc_coins.hpp b/modules/proc/inc/proc_coins.hpp
index 9315324..f1b0824 100644
--- a/modules/proc/inc/proc_coins.hpp
+++ b/modules/proc/inc/proc_coins.hpp
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
@@ -40,7 +41,7 @@ extern "C" {
/******************************************************************************
******* functions ************************************************************
******************************************************************************/
- int proc_coins (void);
+int proc_coins (void);
/******************************************************************************
diff --git a/modules/proc/inc/proc_common.h b/modules/proc/inc/proc_common.h
index 1d4077e..9f84504 100644
--- a/modules/proc/inc/proc_common.h
+++ b/modules/proc/inc/proc_common.h
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
@@ -28,10 +29,10 @@
/******************************************************************************
******* functions ************************************************************
******************************************************************************/
- void proc_show_img (void);
+void proc_show_img (void);
- void clock_start (void);
- void clock_stop (const char *txt);
+void clock_start (void);
+void clock_stop (const char *txt);
/******************************************************************************
diff --git a/modules/proc/inc/proc_common.hpp b/modules/proc/inc/proc_common.hpp
index 7332b84..5ba5faf 100644
--- a/modules/proc/inc/proc_common.hpp
+++ b/modules/proc/inc/proc_common.hpp
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
diff --git a/modules/proc/inc/proc_iface.h b/modules/proc/inc/proc_iface.h
index 8ce304c..1001702 100644
--- a/modules/proc/inc/proc_iface.h
+++ b/modules/proc/inc/proc_iface.h
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
@@ -50,15 +51,15 @@
/******************************************************************************
******* variables ************************************************************
******************************************************************************/
- extern int proc_debug;
- extern int proc_mode;
+extern int proc_debug;
+extern int proc_mode;
/******************************************************************************
******* functions ************************************************************
******************************************************************************/
- int proc_iface_single (int action);
- void proc_iface_series (void);
+int proc_iface_single (int action);
+void proc_iface_series (void);
/******************************************************************************
diff --git a/modules/proc/inc/proc_iface.hpp b/modules/proc/inc/proc_iface.hpp
index ede95f7..a0d0f7d 100644
--- a/modules/proc/inc/proc_iface.hpp
+++ b/modules/proc/inc/proc_iface.hpp
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
@@ -56,15 +57,15 @@ extern "C" {
/******************************************************************************
******* variables ************************************************************
******************************************************************************/
- extern int proc_debug;
- extern int proc_mode;
+extern int proc_debug;
+extern int proc_mode;
/******************************************************************************
******* functions ************************************************************
******************************************************************************/
- int proc_iface_single (int action);
- void proc_iface_series (void);
+int proc_iface_single (int action);
+void proc_iface_series (void);
/******************************************************************************
diff --git a/modules/proc/inc/proc_label.h b/modules/proc/inc/proc_label.h
index a1091b8..d1b78f1 100644
--- a/modules/proc/inc/proc_label.h
+++ b/modules/proc/inc/proc_label.h
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
@@ -36,7 +37,7 @@
/******************************************************************************
******* functions ************************************************************
******************************************************************************/
- int proc_label (void);
+int proc_label (void);
/******************************************************************************
diff --git a/modules/proc/inc/proc_label.hpp b/modules/proc/inc/proc_label.hpp
index b456a55..ebb4446 100644
--- a/modules/proc/inc/proc_label.hpp
+++ b/modules/proc/inc/proc_label.hpp
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
@@ -42,7 +43,7 @@ extern "C" {
/******************************************************************************
******* functions ************************************************************
******************************************************************************/
- int proc_label (void);
+int proc_label (void);
/******************************************************************************
diff --git a/modules/proc/inc/proc_lighters.h b/modules/proc/inc/proc_lighters.h
index f10c533..5771aad 100644
--- a/modules/proc/inc/proc_lighters.h
+++ b/modules/proc/inc/proc_lighters.h
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
@@ -33,7 +34,7 @@
/******************************************************************************
******* functions ************************************************************
******************************************************************************/
- int proc_lighter (void);
+int proc_lighter (void);
/******************************************************************************
diff --git a/modules/proc/inc/proc_lighters.hpp b/modules/proc/inc/proc_lighters.hpp
index cc16a79..7d69dc6 100644
--- a/modules/proc/inc/proc_lighters.hpp
+++ b/modules/proc/inc/proc_lighters.hpp
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
@@ -39,7 +40,7 @@ extern "C" {
/******************************************************************************
******* functions ************************************************************
******************************************************************************/
- int proc_lighter (void);
+int proc_lighter (void);
/******************************************************************************
diff --git a/modules/proc/inc/proc_objects.h b/modules/proc/inc/proc_objects.h
index be841ba..ed865fd 100644
--- a/modules/proc/inc/proc_objects.h
+++ b/modules/proc/inc/proc_objects.h
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
@@ -34,8 +35,8 @@
/******************************************************************************
******* functions ************************************************************
******************************************************************************/
- int proc_objects_calibrate (void);
- int proc_objects (void);
+int proc_objects_calibrate (void);
+int proc_objects (void);
/******************************************************************************
diff --git a/modules/proc/inc/proc_objects.hpp b/modules/proc/inc/proc_objects.hpp
index 1a3084f..8794150 100644
--- a/modules/proc/inc/proc_objects.hpp
+++ b/modules/proc/inc/proc_objects.hpp
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
@@ -40,8 +41,8 @@ extern "C" {
/******************************************************************************
******* functions ************************************************************
******************************************************************************/
- int proc_objects_calibrate (void);
- int proc_objects (void);
+int proc_objects_calibrate (void);
+int proc_objects (void);
/******************************************************************************
diff --git a/modules/proc/inc/proc_resistor.h b/modules/proc/inc/proc_resistor.h
index ca60a8a..dea2ed7 100644
--- a/modules/proc/inc/proc_resistor.h
+++ b/modules/proc/inc/proc_resistor.h
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
@@ -36,7 +37,7 @@
/******************************************************************************
******* functions ************************************************************
******************************************************************************/
- int proc_resistor (void);
+int proc_resistor (void);
/******************************************************************************
diff --git a/modules/proc/inc/proc_resistor.hpp b/modules/proc/inc/proc_resistor.hpp
index fce85d8..31f70cf 100644
--- a/modules/proc/inc/proc_resistor.hpp
+++ b/modules/proc/inc/proc_resistor.hpp
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
@@ -42,7 +43,7 @@ extern "C" {
/******************************************************************************
******* functions ************************************************************
******************************************************************************/
- int proc_resistor (void);
+int proc_resistor (void);
/******************************************************************************
diff --git a/modules/proc/src/proc_coins.cpp b/modules/proc/src/proc_coins.cpp
index 8f26e71..dd347c9 100644
--- a/modules/proc/src/proc_coins.cpp
+++ b/modules/proc/src/proc_coins.cpp
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
diff --git a/modules/proc/src/proc_common.cpp b/modules/proc/src/proc_common.cpp
index 10a8a93..c1e19d5 100644
--- a/modules/proc/src/proc_common.cpp
+++ b/modules/proc/src/proc_common.cpp
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
diff --git a/modules/proc/src/proc_iface.c b/modules/proc/src/proc_iface.c
index 4372b3c..3948039 100644
--- a/modules/proc/src/proc_iface.c
+++ b/modules/proc/src/proc_iface.c
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
diff --git a/modules/proc/src/proc_label.cpp b/modules/proc/src/proc_label.cpp
index 57acf09..840e29e 100644
--- a/modules/proc/src/proc_label.cpp
+++ b/modules/proc/src/proc_label.cpp
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
diff --git a/modules/proc/src/proc_lighters.cpp b/modules/proc/src/proc_lighters.cpp
index f7519a3..a9543b8 100644
--- a/modules/proc/src/proc_lighters.cpp
+++ b/modules/proc/src/proc_lighters.cpp
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
diff --git a/modules/proc/src/proc_objects.cpp b/modules/proc/src/proc_objects.cpp
index 026cb25..6caa919 100644
--- a/modules/proc/src/proc_objects.cpp
+++ b/modules/proc/src/proc_objects.cpp
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
diff --git a/modules/proc/src/proc_resistor.cpp b/modules/proc/src/proc_resistor.cpp
index 58f1fe4..26ef739 100644
--- a/modules/proc/src/proc_resistor.cpp
+++ b/modules/proc/src/proc_resistor.cpp
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
diff --git a/modules/save/inc/save.h b/modules/save/inc/save.h
index a3388d7..4ab65ab 100644
--- a/modules/save/inc/save.h
+++ b/modules/save/inc/save.h
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
@@ -41,30 +42,30 @@
/******************************************************************************
******* variables ************************************************************
******************************************************************************/
- extern char home_path [FILENAME_MAX];
- extern char user_prog_path [FILENAME_MAX];
- extern char saved_path [FILENAME_MAX];
- extern char labels_path [FILENAME_MAX];
- extern char labels_fail_path [FILENAME_MAX];
- extern char lighters_path [FILENAME_MAX];
- extern char lighters_fail_path [FILENAME_MAX];
- extern char objects_path [FILENAME_MAX];
- extern char objects_fail_path [FILENAME_MAX];
- extern char coins_path [FILENAME_MAX];
- extern char coins_fail_path [FILENAME_MAX];
- extern char resistors_path [FILENAME_MAX];
- extern char resistors_fail_path [FILENAME_MAX];
- extern char saved_name [FILENAME_MAX];
+extern char home_path [FILENAME_MAX];
+extern char user_prog_path [FILENAME_MAX];
+extern char saved_path [FILENAME_MAX];
+extern char labels_path [FILENAME_MAX];
+extern char labels_fail_path [FILENAME_MAX];
+extern char lighters_path [FILENAME_MAX];
+extern char lighters_fail_path [FILENAME_MAX];
+extern char objects_path [FILENAME_MAX];
+extern char objects_fail_path [FILENAME_MAX];
+extern char coins_path [FILENAME_MAX];
+extern char coins_fail_path [FILENAME_MAX];
+extern char resistors_path [FILENAME_MAX];
+extern char resistors_fail_path [FILENAME_MAX];
+extern char saved_name [FILENAME_MAX];
/******************************************************************************
******* functions ************************************************************
******************************************************************************/
- void save_init (void);
- void save_cleanup (void);
- void save_clr (void);
- void load_image_file (const char *fpath, const char *fname);
- void save_image_file (const char *fpath, const char *save_as);
+void save_init (void);
+void save_cleanup (void);
+void save_clr (void);
+void load_image_file (const char *fpath, const char *fname);
+void save_image_file (const char *fpath, const char *save_as);
/******************************************************************************
diff --git a/modules/save/inc/save.hpp b/modules/save/inc/save.hpp
index d7640a1..bf60bca 100644
--- a/modules/save/inc/save.hpp
+++ b/modules/save/inc/save.hpp
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
@@ -51,31 +52,31 @@ extern "C" {
/******************************************************************************
******* variables ************************************************************
******************************************************************************/
- extern class cv::Mat image;
- extern char home_path [FILENAME_MAX];
- extern char user_prog_path [FILENAME_MAX];
- extern char saved_path [FILENAME_MAX];
- extern char labels_path [FILENAME_MAX];
- extern char labels_fail_path [FILENAME_MAX];
- extern char lighters_path [FILENAME_MAX];
- extern char lighters_fail_path [FILENAME_MAX];
- extern char objects_path [FILENAME_MAX];
- extern char objects_fail_path [FILENAME_MAX];
- extern char coins_path [FILENAME_MAX];
- extern char coins_fail_path [FILENAME_MAX];
- extern char resistors_path [FILENAME_MAX];
- extern char resistors_fail_path [FILENAME_MAX];
- extern char saved_name [FILENAME_MAX];
+extern class cv::Mat image;
+extern char home_path [FILENAME_MAX];
+extern char user_prog_path [FILENAME_MAX];
+extern char saved_path [FILENAME_MAX];
+extern char labels_path [FILENAME_MAX];
+extern char labels_fail_path [FILENAME_MAX];
+extern char lighters_path [FILENAME_MAX];
+extern char lighters_fail_path [FILENAME_MAX];
+extern char objects_path [FILENAME_MAX];
+extern char objects_fail_path [FILENAME_MAX];
+extern char coins_path [FILENAME_MAX];
+extern char coins_fail_path [FILENAME_MAX];
+extern char resistors_path [FILENAME_MAX];
+extern char resistors_fail_path [FILENAME_MAX];
+extern char saved_name [FILENAME_MAX];
/******************************************************************************
******* functions ************************************************************
******************************************************************************/
- void save_init (void);
- void save_cleanup (void);
- void save_clr (void);
- void load_image_file (const char *fpath, const char *fname);
- void save_image_file (const char *fpath, const char *save_as);
+void save_init (void);
+void save_cleanup (void);
+void save_clr (void);
+void load_image_file (const char *fpath, const char *fname);
+void save_image_file (const char *fpath, const char *save_as);
/******************************************************************************
diff --git a/modules/save/src/save.cpp b/modules/save/src/save.cpp
index 6e948a8..f9e45f8 100644
--- a/modules/save/src/save.cpp
+++ b/modules/save/src/save.cpp
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
diff --git a/modules/user/inc/user_clui.h b/modules/user/inc/user_clui.h
index 916fe00..807c508 100644
--- a/modules/user/inc/user_clui.h
+++ b/modules/user/inc/user_clui.h
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
diff --git a/modules/user/inc/user_iface.h b/modules/user/inc/user_iface.h
index dde7b64..a994ae1 100644
--- a/modules/user/inc/user_iface.h
+++ b/modules/user/inc/user_iface.h
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
@@ -136,22 +137,22 @@
/******************************************************************************
******* variables ************************************************************
******************************************************************************/
- extern int user_iface_mode;
- extern struct User_Iface_Log user_iface_log;
+extern int user_iface_mode;
+extern struct User_Iface_Log user_iface_log;
/******************************************************************************
******* functions ************************************************************
******************************************************************************/
- void user_iface_init (void);
- void user_iface_cleanup (void);
- void user_iface (void);
- void user_iface_show_log (const char *title, const char *subtitle);
- void user_iface_fname (const char *filepath, char *filename);
- double user_iface_getdbl (double m, double def, double M,
- const char *title, const char *help);
- int64_t user_iface_getint (double m, int64_t def, double M,
- const char *title, const char *help);
+void user_iface_init (void);
+void user_iface_cleanup (void);
+void user_iface (void);
+void user_iface_show_log (const char *title, const char *subtitle);
+void user_iface_fname (const char *filepath, char *filename);
+double user_iface_getdbl (double m, double def, double M,
+ const char *title, const char *help);
+int64_t user_iface_getint (double m, int64_t def, double M,
+ const char *title, const char *help);
/******************************************************************************
diff --git a/modules/user/inc/user_iface.hpp b/modules/user/inc/user_iface.hpp
index d01f3a3..26fadfb 100644
--- a/modules/user/inc/user_iface.hpp
+++ b/modules/user/inc/user_iface.hpp
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
@@ -142,22 +143,22 @@ extern "C" {
/******************************************************************************
******* variables ************************************************************
******************************************************************************/
- extern int user_iface_mode;
- extern struct User_Iface_Log user_iface_log;
+extern int user_iface_mode;
+extern struct User_Iface_Log user_iface_log;
/******************************************************************************
******* functions ************************************************************
******************************************************************************/
- void user_iface_init (void);
- void user_iface_cleanup (void);
- void user_iface (void);
- void user_iface_show_log (const char *title, const char *subtitle);
- void user_iface_fname (const char *filepath, char *filename);
- double user_iface_getdbl (double m, double def, double M,
- const char *title, const char *help);
- int64_t user_iface_getint (double m, int64_t def, double M,
- const char *title, const char *help);
+void user_iface_init (void);
+void user_iface_cleanup (void);
+void user_iface (void);
+void user_iface_show_log (const char *title, const char *subtitle);
+void user_iface_fname (const char *filepath, char *filename);
+double user_iface_getdbl (double m, double def, double M,
+ const char *title, const char *help);
+int64_t user_iface_getint (double m, int64_t def, double M,
+ const char *title, const char *help);
/******************************************************************************
diff --git a/modules/user/inc/user_tui.h b/modules/user/inc/user_tui.h
index c9c027c..64dd880 100644
--- a/modules/user/inc/user_tui.h
+++ b/modules/user/inc/user_tui.h
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
diff --git a/modules/user/src/user_clui.c b/modules/user/src/user_clui.c
index 218c14b..11e7db1 100644
--- a/modules/user/src/user_clui.c
+++ b/modules/user/src/user_clui.c
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
@@ -70,22 +71,22 @@ int user_clui (const char *title, const char *subtitle)
void user_clui_fname (const char *filepath, char *filename)
{
- puts("File name:");
- puts("Valid extensions: .bmp .dib .jpeg .png .pbm .pgm .ppm .tiff");
+ printf("File name:\n");
+ printf("Valid extensions: .bmp .dib .jpeg .png .pbm .pgm .ppm .tiff\n");
fgets(filename, FILENAME_MAX, stdin);
alx_sscan_fname(filepath, filename, false, filename);
}
void user_clui_show_log (const char *title, const char *subtitle)
{
- puts("________________________________________________________________________________");
+ printf("________________________________________________________________________________\n");
/* Board */
log_loop();
/* Subtitle & title */
printf("%s - %s\n", subtitle, title);
- puts("--------------------------------------------------------------------------------");
+ printf("--------------------------------------------------------------------------------\n");
}
@@ -128,7 +129,10 @@ static int usr_input (void)
fgets(buff, BUFF_SIZE, stdin);
/* Interpret input */
- sscanf(buff, " %c%c%c%c%c", &ch[0], &ch[1], &ch[2], &ch[3], &ch[4]);
+ if (sscanf(buff, " %c%c%c%c%c", &ch[0], &ch[1], &ch[2], &ch[3], &ch[4])) {
+ ch[0] = '\0';
+ }
+ action = USER_IFACE_ACT_FOO;
switch (ch[0]) {
case '+':
action = USER_IFACE_ACT_APPLY;
diff --git a/modules/user/src/user_iface.c b/modules/user/src/user_iface.c
index f465944..46576f3 100644
--- a/modules/user/src/user_iface.c
+++ b/modules/user/src/user_iface.c
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
@@ -43,8 +44,8 @@ struct User_Iface_Log user_iface_log;
/******************************************************************************
******* static functions *****************************************************
******************************************************************************/
-void user_iface_act (int action);
-void user_iface_show_ocr (void);
+static void user_iface_act (int action);
+static void user_iface_show_ocr (void);
/******************************************************************************
@@ -188,7 +189,7 @@ double user_iface_getdbl (double m, double def, double M,
/******************************************************************************
******* static functions *****************************************************
******************************************************************************/
-void user_iface_act (int action)
+static void user_iface_act (int action)
{
if (action & USER_IFACE_ACT_USRI) {
switch (action) {
@@ -208,7 +209,7 @@ void user_iface_act (int action)
}
}
-void user_iface_show_ocr (void)
+static void user_iface_show_ocr (void)
{
switch (user_iface_mode) {
case USER_IFACE_CLUI:
diff --git a/modules/user/src/user_tui.c b/modules/user/src/user_tui.c
index 83c729d..70220fc 100644
--- a/modules/user/src/user_tui.c
+++ b/modules/user/src/user_tui.c
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/
@@ -49,21 +50,30 @@ static void show_help (void);
******************************************************************************/
void user_tui_init (void)
{
+ int h1;
+ int w1;
+ int r1;
+ int c1;
+ int h2;
+ int w2;
+ int r2;
+ int c2;
+
/* Use curses mode */
alx_resume_curses();
/* Dimensions: log */
- const int h1 = 54;
- const int w1 = 40;
- const int r1 = 0;
- const int c1 = 30;
- win_log = newwin(h1, w1, r1, c1);
+ h1 = 54;
+ w1 = 40;
+ r1 = 0;
+ c1 = 30;
+ win_log = newwin(h1, w1, r1, c1);
/* Dimensions: help */
- const int h2 = 54;
- const int w2 = 40;
- const int r2 = 0;
- const int c2 = 0;
+ h2 = 54;
+ w2 = 40;
+ r2 = 0;
+ c2 = 0;
win_help = newwin(h2, w2, r2, c2);
/* Activate keypad, don't echo input */
@@ -73,6 +83,7 @@ void user_tui_init (void)
void user_tui_cleanup (void)
{
+
/* Del wins & return to terminal mode */
alx_win_del(win_log);
alx_win_del(win_help);
@@ -82,7 +93,6 @@ void user_tui_cleanup (void)
int user_tui (const char *title, const char *subtitle)
{
int action;
-// action = USER_IFACE_ACT_FOO;
show_help();
user_tui_show_log(title, subtitle);
@@ -93,9 +103,10 @@ int user_tui (const char *title, const char *subtitle)
void user_tui_fname (const char *filepath, char *filename)
{
- /* Input box */
int w;
int r;
+
+ /* Input box */
w = 75;
r = 10;
@@ -106,6 +117,7 @@ void user_tui_fname (const char *filepath, char *filename)
void user_tui_show_log (const char *title, const char *subtitle)
{
+
/* Clear & box */
werase(win_log);
box(win_log, 0, 0);
@@ -125,15 +137,17 @@ void user_tui_show_log (const char *title, const char *subtitle)
double user_tui_getdbl (double m, double def, double M,
const char *title, const char *help)
{
- /* Input box */
int w;
int r;
+ double R;
+
+ /* Input box */
w = 75;
r = 10;
/* Request int */
- double R;
R = alx_w_getdbl(w, r, title, m, def, M, help);
+
return R;
}
@@ -143,17 +157,20 @@ int64_t user_tui_getint (double m, int64_t def, double M,
/* Input box */
int w;
int r;
+ int64_t i;
+
w = 75;
r = 10;
/* Request int */
- int64_t i;
i = alx_w_getint(w, r, title, m, def, M, help);
+
return i;
}
void user_tui_show_ocr (void)
{
+
alx_pause_curses();
printf("%s", img_ocr_text);
@@ -705,12 +722,12 @@ static int usr_input (void)
* * * * * * * * * */
static void show_help (void)
{
- /* Clear */
- werase(win_help);
-
int r;
int c;
+ /* Clear */
+ werase(win_help);
+
r = 0;
c = 0;
mvwprintw(win_help, r++, c, "Apply: %s", "Space");
diff --git a/src/main.cpp b/src/main.cpp
index f672b68..c213594 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,5 +1,6 @@
/******************************************************************************
* Copyright (C) 2018 Alejandro Colomar Andrés *
+ * SPDX-License-Identifier: GPL-2.0-only *
******************************************************************************/