blob: 50c7d5d5fc516f50f92d8345aee92e04e5d296be (
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
/*
* anylike
*
* anylike is a ...
*
*
* Copyright (C) 2009-2010 Markus Grueneis <gimpf@anylike.org>
* Christian Pointner <equinox@anylike.org>
*
* This file is part of anylike.
*
* anylike is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* anylike is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with anylike. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdlib.h>
#include <stdio.h>
#include <lua50/lua.h>
#include "datatypes.h"
#include "options.h"
int main_loop(options_t* opt)
{
lua_State *L;
L = lua_open();
luaopen_base(L);
printf("will now start main_loop.lua:\n");
lua_dofile(L, "main_loop.lua");
printf("script.lua just returned\n");
lua_close(L);
return 0;
}
int main(int argc, char* argv[])
{
options_t opt;
int ret = options_parse(&opt, argc, argv);
if(ret) {
if(ret > 0) {
fprintf(stderr, "syntax error near: %s\n\n", argv[ret]);
}
if(ret == -2) {
fprintf(stderr, "memory error on options_parse, exitting\n");
}
if(ret == -3) {
options_print_version();
}
if(ret != -2 && ret != -3)
options_print_usage();
if(ret == -1 || ret == -3)
ret = 0;
options_clear(&opt);
exit(ret);
}
options_parse_post(&opt);
ret = main_loop(&opt);
options_clear(&opt);
return ret;
}
|