summaryrefslogtreecommitdiffstats
path: root/src/ctrl/start.c
blob: eb78e66e79d7a23bda2b2477e1e5e883bba9702d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/******************************************************************************
 *	Copyright (C) 2018	Alejandro Colomar Andrés		      *
 *	SPDX-License-Identifier:	GPL-2.0-only			      *
 ******************************************************************************/


/******************************************************************************
 ******* headers **************************************************************
 ******************************************************************************/
#include "vision-artificial/ctrl/start.h"

#include <errno.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>

#define ALX_NO_PREFIX
#include <alx/base/errno.h>

#include "vision-artificial/image/iface.h"
#include "vision-artificial/save/save.h"
#include "vision-artificial/user/iface.h"


/******************************************************************************
 ******* variables ************************************************************
 ******************************************************************************/


/******************************************************************************
 ******* static functions *****************************************************
 ******************************************************************************/


/******************************************************************************
 ******* main *****************************************************************
 ******************************************************************************/
void	start_switch	(void)
{

	if (!saved_name[0])
		return;

	img_iface_init();
	errno	= 0;
	img_iface_load(NULL, saved_name);

	if (errno)
		goto err;

	user_iface_init();
	user_iface();
	user_iface_cleanup();
err:
	perrorx(saved_name);
	img_iface_cleanup();
}


/******************************************************************************
 ******* static functions *****************************************************
 ******************************************************************************/


/******************************************************************************
 ******* end of file **********************************************************
 ******************************************************************************/