2
2
#![ allow( non_snake_case) ]
3
3
#![ allow( non_upper_case_globals) ]
4
4
5
- use Command_line_shell :: Shell_executable_type ;
5
+ use Executable :: Mount_static_executables ;
6
6
use Executable :: Standard_type ;
7
- use File_system :: { Create_device , Create_file_system , Mode_type } ;
8
- use WASM :: WASM_device_type ;
7
+ use File_system :: { Create_device , Create_file_system } ;
8
+ use Virtual_file_system :: Mount_static_devices ;
9
9
10
10
fn main ( ) {
11
11
// - Initialize the system
@@ -18,13 +18,19 @@ fn main() {
18
18
// - Initialize the graphics manager
19
19
// - - Initialize the graphics driver
20
20
const Resolution : Graphics :: Point_type = Graphics :: Point_type :: New ( 800 , 600 ) ;
21
- let ( Screen , Pointer ) = Drivers :: Native :: Window_screen :: New ( Resolution ) . unwrap ( ) ;
21
+ let ( Screen_device , Pointer_device , Keyboard_device ) =
22
+ Drivers :: Native :: Window_screen :: New ( Resolution ) . unwrap ( ) ;
22
23
// - - Initialize the graphics manager
23
- Graphics :: Initialize ( ) ;
24
- // - - Add a screen
25
- const Buffer_size : usize = Graphics :: Get_recommended_buffer_size ( & Resolution ) ;
26
- let _ = Graphics :: Get_instance ( )
27
- . Create_display :: < Buffer_size > ( Screen , Pointer , true )
24
+ Graphics :: Initialize (
25
+ Screen_device ,
26
+ Pointer_device ,
27
+ Graphics :: Input_type_type :: Pointer ,
28
+ Graphics :: Get_minimal_buffer_size ( & Resolution ) ,
29
+ true ,
30
+ ) ;
31
+
32
+ Graphics :: Get_instance ( )
33
+ . Add_input_device ( Keyboard_device , Graphics :: Input_type_type :: Keypad )
28
34
. unwrap ( ) ;
29
35
30
36
// - Initialize the file system
@@ -45,50 +51,88 @@ fn main() {
45
51
}
46
52
} ;
47
53
// Initialize the virtual file system
48
- Virtual_file_system :: Initialize ( Create_file_system ! ( File_system ) ) ;
54
+ Virtual_file_system :: Initialize ( Create_file_system ! ( File_system ) ) . unwrap ( ) ;
49
55
50
56
// - - Mount the devices
51
57
let Task = Task :: Get_instance ( ) . Get_current_task_identifier ( ) . unwrap ( ) ;
52
58
53
- Virtual_file_system :: Get_instance ( )
54
- . Mount_static_device ( Task , & "/Shell" , Create_device ! ( Shell_executable_type ) )
55
- . unwrap ( ) ;
59
+ // - - Create the default system hierarchy
60
+ let _ =
61
+ Virtual_file_system :: Create_default_hierarchy ( Virtual_file_system :: Get_instance ( ) , Task ) ;
56
62
57
- Virtual_file_system :: Get_instance ( )
58
- . Mount_static_device ( Task , & "/WASM" , Create_device ! ( WASM_device_type ) )
59
- . unwrap ( ) ;
63
+ // - - Mount the devices
64
+ Virtual_file_system :: Clean_devices ( Virtual_file_system :: Get_instance ( ) ) . unwrap ( ) ;
60
65
61
- let _ = Virtual_file_system :: Get_instance ( ) . Create_directory ( & "/Devices" , Task ) ;
66
+ Mount_static_devices ! (
67
+ Virtual_file_system :: Get_instance ( ) ,
68
+ Task ,
69
+ & [
70
+ (
71
+ & "/Devices/Standard_in" ,
72
+ Drivers :: Native :: Console :: Standard_in_device_type
73
+ ) ,
74
+ (
75
+ & "/Devices/Standard_out" ,
76
+ Drivers :: Native :: Console :: Standard_out_device_type
77
+ ) ,
78
+ (
79
+ & "/Devices/Standard_error" ,
80
+ Drivers :: Native :: Console :: Standard_error_device_type
81
+ ) ,
82
+ ( & "/Devices/Time" , Drivers :: Native :: Time_driver_type ) ,
83
+ ( & "/Devices/Random" , Drivers :: Native :: Random_device_type ) ,
84
+ ( & "/Devices/Null" , Drivers :: Common :: Null_device_type )
85
+ ]
86
+ )
87
+ . unwrap ( ) ;
62
88
63
- Drivers :: Native :: Console :: Mount_devices ( Task , Virtual_file_system :: Get_instance ( ) ) . unwrap ( ) ;
64
89
// Initialize the virtual machine
65
90
Virtual_machine :: Initialize ( & [ & Host_bindings :: Graphics_bindings ] ) ;
66
91
92
+ // Mount static executables
93
+
94
+ let Virtual_file_system = Virtual_file_system :: Get_instance ( ) ;
95
+
96
+ Mount_static_executables ! (
97
+ Virtual_file_system ,
98
+ Task ,
99
+ & [
100
+ Graphical_shell :: Shell_executable_type ,
101
+ Command_line_shell :: Shell_executable_type ,
102
+ Terminal :: Terminal_executable_type ,
103
+ WASM :: WASM_device_type
104
+ ]
105
+ )
106
+ . unwrap ( ) ;
107
+
67
108
// - Execute the shell
68
109
// - - Open the standard input, output and error
69
- let Standard_in = Virtual_file_system :: Get_instance ( )
70
- . Open ( & "/Devices/Standard_in" , Mode_type :: Read_only . into ( ) , Task )
71
- . unwrap ( ) ;
110
+ let Standard = Standard_type :: Open (
111
+ & "/Devices/Standard_in" ,
112
+ & "/Devices/Standard_out" ,
113
+ & "/Devices/Standard_error" ,
114
+ Task ,
115
+ Virtual_file_system :: Get_instance ( ) ,
116
+ )
117
+ . unwrap ( ) ;
72
118
73
- let Standard_out = Virtual_file_system :: Get_instance ( )
74
- . Open ( & "/Devices/Standard_out" , Mode_type :: Write_only . into ( ) , Task )
75
- . unwrap ( ) ;
119
+ // - - Create the default user
120
+ let Group_identifier = Users :: Group_identifier_type :: New ( 1000 ) ;
76
121
77
- let Standard_error = Virtual_file_system :: Get_instance ( )
78
- . Open (
79
- & "/Devices/Standard_error" ,
80
- Mode_type :: Write_only . into ( ) ,
81
- Task ,
82
- )
83
- . unwrap ( ) ;
122
+ let _ = Authentication :: Create_group (
123
+ Virtual_file_system :: Get_instance ( ) ,
124
+ "alix_anneraud" ,
125
+ Some ( Group_identifier ) ,
126
+ ) ;
84
127
85
- let Standard = Standard_type :: New (
86
- Standard_in ,
87
- Standard_out ,
88
- Standard_error ,
89
- Task ,
128
+ let _ = Authentication :: Create_user (
90
129
Virtual_file_system :: Get_instance ( ) ,
130
+ "alix_anneraud" ,
131
+ "password" ,
132
+ Group_identifier ,
133
+ None ,
91
134
) ;
135
+
92
136
// - - Set the environment variables
93
137
Task :: Get_instance ( )
94
138
. Set_environment_variable ( Task , "Paths" , "/" )
@@ -98,7 +142,7 @@ fn main() {
98
142
. Set_environment_variable ( Task , "Host" , "xila" )
99
143
. unwrap ( ) ;
100
144
// - - Execute the shell
101
- let _ = Executable :: Execute ( "/Shell " , "" . to_string ( ) , Standard )
145
+ let _ = Executable :: Execute ( "/Binaries/Graphical_shell " , "" . to_string ( ) , Standard )
102
146
. unwrap ( )
103
147
. Join ( )
104
148
. unwrap ( ) ;
0 commit comments