forked from vygr/ChrysaLisp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
funcs.sh
69 lines (62 loc) · 909 Bytes
/
funcs.sh
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
#useful functions
OS=`cat platform`
CPU=`cat arch`
function zero_pad
{
if [ $1 -lt 100 ]
then
zp="0$1"
else
zp=$1
fi
if [ $zp -lt 10 ]
then
zp="0$zp"
fi
}
function add_link
{
if [ $1 != $2 ]
then
if [ $1 -lt $2 ]
then
nl=$1-$2
else
nl=$2-$1
fi
if [[ "$links" != *"$nl"* ]]
then
links+="-l $nl "
fi
fi
}
function wrap
{
wp=$(($1 % $num_cpu))
if [ $wp -lt 0 ]
then
wp=$(($wp + $num_cpu))
fi
}
function boot_cpu_gui
{
# if [ $1 -lt 2 ]
if [ $1 -lt 1 ]
then
./obj/$OS/$CPU/main obj/$OS/$CPU/sys/boot_image -cpu $1 $2 -run gui/gui &
else
./obj/$OS/$CPU/main obj/$OS/$CPU/sys/boot_image -cpu $1 $2 &
fi
echo -cpu $1 $2
}
function boot_cpu_tui
{
if [ $1 -lt 1 ]
then
./obj/$OS/$CPU/main obj/$OS/$CPU/sys/boot_image -cpu $1 $2 -run apps/terminal/tui
else
./obj/$OS/$CPU/main obj/$OS/$CPU/sys/boot_image -cpu $1 $2 &
fi
echo -cpu $1 $2
}
./stop.sh