-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigs.sh
97 lines (87 loc) · 2.41 KB
/
configs.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
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
#!/bin/bash
# A bunch of commands to make life easier
EXPOS_DIR=~/PROJ/evOS
alias XCD='cd $EXPOS_DIR'
function XFS() {
if [[ $1 == "-l" || $1 == "--load" ]]; then
XFS_EXEC_LIST=$(realpath -e $2)
cd $EXPOS_DIR/xfs-interface
echo "Executing $XFS_EXEC_LIST"
cat $XFS_EXEC_LIST | grep -v "^#" # Treat lines starting with # as a comment
echo "--------------------------"
cat $XFS_EXEC_LIST | grep -v "^#" | xargs -I {} ./xfs-interface {}
cd - > /dev/null
else
cd $EXPOS_DIR/xfs-interface
./xfs-interface
cd - > /dev/null
fi
}
function SPL() {
if [[ -d $1 ]]; then
echo "Compiling all spl programs"
ABS_PATH=$(realpath -e $1)
cd $EXPOS_DIR/spl
find $ABS_PATH | grep .spl | xargs -I {} sh -c 'echo "Compiling: "{}"" && ./spl "{}" && echo'
cd -
else
ABS_PATH=$(realpath -e $1)
cd $EXPOS_DIR/spl
echo Input Path: $ABS_PATH
./spl $ABS_PATH
cd -
fi
}
function EXPL() {
if [[ -d $1 ]]; then
echo "Compiling all expl programs"
ABS_PATH=$(realpath -e $1)
cd $EXPOS_DIR/expl
find $ABS_PATH | grep .expl | xargs -I {} sh -c 'echo "Compiling: "{}"" && ./expl "{}" && echo'
cd -
else
ABS_PATH=$(realpath -e $1)
cd $EXPOS_DIR/expl
echo Input Path: $ABS_PATH
./expl $ABS_PATH
cd -
fi
}
function XSM() {
cd $EXPOS_DIR/xsm
echo "Starting XSM..."
clear
./xsm $@
cd -
}
function XMEM() {
nvim -R $EXPOS_DIR/xsm/mem
}
function XGREP() {
if [ $1 = "-f" ]; then
grep -niR "$2" $EXPOS_DIR/exposnitc.github.io
elif [[ $1 == "-fo" ]]; then
find $EXPOS_DIR/exposnitc.github.io/ | grep "$2"
elif [[ $1 == "-g" ]]; then
firefox "https://www.google.com/search?q=site:exposnitc.github.io $2"
else
grep -niR --color=always "$1" $EXPOS_DIR/exposnitc.github.io | sed 's/<[^>]*>//g'
fi
}
function XPHY() {
logical_address=$2
while read -r xphy_line
do
printf "%10s ┃ %s\n" "${logical_address}" "$xphy_line"
echo ${xphy_line} | grep "^[0-9]" > /dev/null
local return_code=$?
if [[ $return_code == 0 ]];
then
logical_address=$(( ${logical_address} + 1 ))
else
logical_address=$(( ${logical_address} + 2 ))
fi
done < $1
}
export -f SPL
export -f EXPL