-
Notifications
You must be signed in to change notification settings - Fork 0
/
solo.cpp
executable file
·111 lines (84 loc) · 3.56 KB
/
solo.cpp
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// SPDX: AGPL-3.0-only
/* XEPL Solo Environment - Copyright (c) 2024 Keith Edwin Robbins
Project Name: XEPL Solo Environment
File Name: solo.cc
Author: Keith Edwin Robbins
Release date: May 10, 2024
Website: https://xepl.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation version 3 of the License.
This program 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
For more information about the AGPL, please visit:
https://www.gnu.org/licenses/agpl-3.0.html
*/
#include "../one/xepl.hpp"
#include "../kits/xepl_all_kits.cc"
#include "../kits/PerformanceTimer.hpp"
int main_brain( XEPL::Text* _command, XEPL::Text* _sys_command )
{
bool reboot = true;
do
{
XEPL::Cortex cortex ( "brain", std::cout );
KITS::TIMER::Initialize(100);
{
KITS::OPERATORS::Register_Operator_Kit ( &cortex );
KITS::KEYWORDS::Register_Keyword_Kit ( &cortex );
KITS::SPLICERS::Register_Splicer_Kit ( &cortex );
KITS::SOCKETS::Register_Socket_Kit ( &cortex );
KITS::FILES::Register_File_Kit ( &cortex );
KITS::TEXT::Register_Text_Kit ( &cortex );
KITS::HTTP::Register_Http_Kit ( &cortex );
KITS::HTML::Register_Html_Kit ( &cortex );
KITS::TIMER::Register_Timer_Kit ( &cortex );
KITS::MAIN::Register_Main_Kit ( &cortex );
cortex.Register_Mutual ( "trigger", [] ( XEPL::Nucleus* ) { return static_cast<XEPL::Gene*> ( XEPL::tlsLobe->trigger_atom ); } );
cortex.Register_Mutual ( "outdex", [] ( XEPL::Nucleus* ) { return XEPL::tlsLobe->outdex_link; } );
cortex.Register_Mutual ( "locals", [] ( XEPL::Nucleus* ) { return XEPL::tlsLobe->locals; } );
cortex.Register_Mutual ( "observer", [] ( XEPL::Nucleus* _nucleus ) { return _nucleus->Host()->observer; });
cortex.Register_Mutual ( "shadows", [] ( XEPL::Nucleus* _nucleus ) { return _nucleus->Host()->shadows; });
cortex.Register_Command ( "Trace", [] ( XEPL::String* _opt ) { XEPL::Show_Trace = _opt->compare("off"); });
cortex.Register_Command ( "Counters", [] ( XEPL::String* _opt ) { XEPL::Show_Counters = _opt->compare("off"); });
cortex.Register_Command ( "Memory", [] ( XEPL::String* _opt ) { XEPL::Show_Memory_Counts = _opt->compare("off"); });
KITS::CLI::Execute_Command( _command );
system( _sys_command );
reboot = KITS::CLI::CliLoop(std::cin, std::cout, std::cerr);
cortex.Close_Cortex();
}
KITS::TIMER::Shutdown();
} while ( reboot );
return 0;
}
#ifdef _WIN32
int main ( int, char**, char** )
{
WSADATA wsaData;
WSAStartup(MAKEWORD(2,2), &wsaData);
KITS::MAIN::Initialize( argc, argv, argenv );
main_brain( "}solo", "cmd /c start http://localhost:8100" );
WSACleanup();
return 0;
}
#elif __linux__
int main ( int, char**, char** )
{
signal ( SIGPIPE, SIG_IGN );
KITS::MAIN::Initialize( argc, argv, argenv );
main_brain( "}solo", "xdg-open http://localhost:8100" );
return 0;
}
#else
int main ( int argc, char** argv, char** argenv)
{
signal ( SIGPIPE, SIG_IGN );
KITS::MAIN::Initialize( argc, argv, argenv );
main_brain( "}solo", "open http://localhost:8100" );
return 0;
}
#endif