-
Notifications
You must be signed in to change notification settings - Fork 98
/
Copy pathfuncs.ps1
115 lines (101 loc) · 2.13 KB
/
funcs.ps1
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
111
112
113
114
115
$NHCPU = "x86_64"
$NHABI = "WIN64"
$NHOS = "Windows"
function zero_pad {
param (
$c
)
if ( $c -lt 100 ){
$zp = "0$c"
}
else {
$zp = $c
}
if ( $c -lt 10 ){
$zp = "0$zp"
}
$zp
}
function add_link
{
param (
$src,
$dst,
$links
)
$src = zero_pad $($src + $bcpu);
$dst = zero_pad $($dst + $bcpu);
if ( $src -ne $dst ){
if ( $src -lt $dst ){
$nl="$src-$dst"
}
else {
$nl="$dst-$src"
}
if ( $links.IndexOf($nl) -eq -1 ){
$rv = "-l $nl "
}
else {
$rv = ""
}
}
$rv
}
function wrap
{
param (
$cpu,
$num_cpu
)
$wp=$(($cpu % $num_cpu))
if ( $wp -lt 0 ){
$wp=$(($wp + $num_cpu))
}
$wp
}
function boot_cpu_gui
{
param (
$front,
$cpu,
$link
)
$cmd = "./obj/$($NHCPU)/$($NHABI)/$($NHOS)/main_gui"
if ( $cpu -lt 1 ){
if ( $front -eq $FALSE ){
Start-Process -FilePath $cmd -NoNewWindow -ArgumentList "obj/$($HCPU)/$($HABI)/sys/boot_image $link -run service/gui/app.lisp"
}
else {
$process = Start-Process -FilePath $cmd -NoNewWindow -ArgumentList "obj/$($HCPU)/$($HABI)/sys/boot_image $link -run service/gui/app.lisp" -PassThru -Wait
if ( $process.ExitCode -eq 0){
Stop-Process -Name main_gui -Force 2>&1 | out-null
}
}
}
else {
Start-Process -FilePath $cmd -NoNewWindow -ArgumentList "obj/$($HCPU)/$($HABI)/sys/boot_image $link"
}
}
function boot_cpu_tui
{
param (
$front,
$cpu,
$link
)
$cmd = "./obj/$($NHCPU)/$($NHABI)/$($NHOS)/main_tui";
if ( $cpu -lt 1 ){
if ( $front -eq $FALSE ){
Start-Process -FilePath $cmd -NoNewWindow -ArgumentList "obj/$($HCPU)/$($HABI)/sys/boot_image $link -run apps/tui/tui.lisp"
}
else {
$process = Start-Process -FilePath $cmd -NoNewWindow -ArgumentList "obj/$($HCPU)/$($HABI)/sys/boot_image $link -run apps/tui/tui.lisp" -PassThru -Wait
if ( $process.ExitCode -eq 0){
Stop-Process -Name main_tui -Force 2>&1 | out-null
}
}
}
else {
Start-Process -FilePath $cmd -NoNewWindow -ArgumentList "obj/$($HCPU)/$($HABI)/sys/boot_image $link"
}
}