/
process.monkey
89 lines (67 loc) · 1.36 KB
/
process.monkey
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
Strict
Public
' Preprocessor related:
' Nothing so far.
' Imports:
Import core ' "meta"
#If Not VIRTUALOS_IMPLEMENTED
#If VIRTUALOS_REAL
#If Not VIRTUALOS_REAL_USE_BRL
Import os
#Else
#If VIRTUALOS_REAL_PROCESS
Import brl.process
#End
#End
#End
#Else
#If Not VIRTUALOS_TRADITIONAL
Import "native/process.js"
#End
#End
#If VIRTUALOS_IMPLEMENTED
' External bindings:
Extern
' Functions (External):
' API:
Function AppPath:String()
Function AppArgs:String[]()
Function ChangeDir:Int(Path:String)
Function CurrentDir:String()
#If Not VIRTUALOS_MAP_ENV
Function SetEnv:Int(Name:String, Value:String)
Function GetEnv:String(Name:String)
#End
Function Execute:Int(CMD:String)
#If Not VIRTUALOS_DEBUG
Function ExitApp:Int(RetCode:Int)
#Else
Function __ExitApp:Int(RetCode:Int)="ExitApp"
#End
Public
' Global variable(s) (Private):
Private
#If VIRTUALOS_MAP_ENV
Global __OS_Env:= New StringMap<String>()
#End
Public
' Functions (Monkey) (Public):
' API:
#If VIRTUALOS_MAP_ENV
Function SetEnv:Void(Name:String, Value:String)
__OS_Env.Set(Name, Value)
Return
End
Function GetEnv:String(Name:String)
Return __OS_Env.Get(Name)
End
#End
' Debugging related:
#If VIRTUALOS_DEBUG
Function ExitApp:Int(RetCode:Int)
DebugStop()
__ExitApp(RetCode)
Return 0
End
#End
#End