-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathb.sh
executable file
·67 lines (54 loc) · 1.69 KB
/
b.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
#!/bin/bash
# Variables
INPUT_FILE="sialk.c"
OUTPUT_FILE="s"
EXAMPLE_FILE="input.sialk"
# Check if an argument is provided
if [ "$#" -eq 1 ]; then
EXAMPLE_FILE="$1"
fi
# Clear screen
clear
# Delete file
if [ -e "$OUTPUT_FILE" ]; then
rm "$OUTPUT_FILE"
fi
# Check if ldconfig command is available
if ! command -v ldconfig &>/dev/null; then
echo "ldconfig command is not found. Please install ldconfig."
exit 1
fi
ldconfig -p | grep efence &>/dev/null
if ! [ $? -eq 0 ]; then
echo "efence library is missing"
echo "Install efence - Electric Fence Malloc Debugger"
exit 1
fi
echo "efence library is installed"
# Compile
# gcc -g -ggdb -g -o "$OUTPUT_FILE" "$INPUT_FILE"
# gcc -g -fsanitize=undefined,address -Walloca -o "$OUTPUT_FILE" "$INPUT_FILE" -lefence
# gcc -g -fsanitize=undefined,address -Walloca -o "$OUTPUT_FILE" "$INPUT_FILE"
gcc -o "$OUTPUT_FILE" "$INPUT_FILE"
# if [ $? -eq 0 ]; then
# if ! [ -x "$(command -v emcc)" ]; then
# echo 'Error: emcc is not installed.' >&2
# echo 'Install from https://emscripten.org/docs/getting_started/downloads.html'
# exit 1
# fi
# # Compiling for web
# emcc sialk.c -o sialk.js -s ALLOW_MEMORY_GROWTH=1 -s EXIT_RUNTIME=1 -s NO_EXIT_RUNTIME=1
# fi
# Check if compilation was successful
if [ $? -eq 0 ]; then
./"$OUTPUT_FILE" "$EXAMPLE_FILE"
# LSAN_OPTIONS=verbosity=1:log_threads=1 ./"$OUTPUT_FILE" "$EXAMPLE_FILE"
# ASAN_OPTIONS=detect_leaks=1 ./"$OUTPUT_FILE" "$EXAMPLE_FILE"
# LSAN_OPTIONS=verbosity=1:log_threads=1:detect_leaks=1 ./"$OUTPUT_FILE" "$EXAMPLE_FILE"
else
echo "Compilation failed!"
fi
# ./s --code "تابع سیلک {\n نمایش \"سیلک، دنیا\"}"
./s --code "تابع سیلک() {
نمایش \"سیلک، دنیا\"
}"