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
82
83
84
85
86
87
88
|
/*
slulrt.h -- Definitions for interfacing with the SLUL runtime
Copyright © 2023-2024 Samuel Lidén Borell <samuel@kodafritt.se>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
As an exception from the license above, permission is hereby granted to
omit the copyright notice and permission notice otherwise required by the
license, and to use this file without any requirement of attribution.
*/
#ifndef SLULRT_H
#ifdef SLULRT
#if defined(_WIN32) || defined(__CYGWIN__)
#define SLULRTAPI __declspec(dllexport)
#else
#define SLULRTAPI
#endif
#elif defined(_WIN32) || defined(__CYGWIN__)
#define SLULRTAPI __declspec(dllimport)
#elif defined(__has_attribute)
#if __has_attribute(visibility)
#define SLULRTAPI __attribute__((visibility("default")))
#else
#define SLULRTAPI
#endif
#elif __GNUC__ >= 4
#define SLULRTAPI __attribute__((visibility("default")))
#else
#define SLULRTAPI
#endif
struct SlulArena;
struct SlulApp;
typedef int SlulExitStatus;
/**
* Initializes a root arena for an application, and returns a new
* SlulApp instance in the new arena.
*
* The arena will have full capability to call system; all system functions
* will call the libc.
*
* \param argc Argument count, or 0 if this information is not provided by
* the OS at startup (e.g. on Windows).
* \param argv Argument vector, or NULL if not provided by the OS at startup.
* \return A new SlulApp, allocated in a new root arena.
*/
extern SLULRTAPI struct SlulApp *SlulApp_init_full(int argc, char **argv);
/* TODO add a function to create an unrestricted SlulArena from argc/argv? */
/**
* Creates a new SlulApp within the given arena.
*
* The command-line arguments are taken from the arena.
*/
extern SLULRTAPI struct SlulApp *SlulApp_init_restricted(struct SlulArena *arena);
/**
* Frees a SlulApp instance.
*/
extern SLULRTAPI void SlulApp_finalize(struct SlulApp *app);
#endif
|