-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.bat
201 lines (172 loc) · 4.09 KB
/
run.bat
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
@echo off
title Profiling Suite :)
set file= ""
set toggle= "false"
set use_file= "false"
echo This program will run the nilakantha algorithm to determine the value of pi to a decimal precision you specify.
echo/
::each program must handle outputting on its own.
::this program can stitch the outputs together and reset them etc.
:menu
cls
echo --MENU--
echo [L] Language Select
echo [S] Settings
set /p input= "Enter Menu Option: "
cls
if %input% == L (goto :main) else if %input% == l (goto :main) else if %input% == S (goto :settings) else if %input% == s (goto :settings)
goto :menu
:settings
cls
echo --Settings--
if %toggle% == "false" (
echo Input file toggled off
) else if %file% == "" (
echo No input file set
) else (
echo Input file set to be %file%
)
echo/
echo [I] Set standard input file
echo [T] Toggle input file on/off
echo [G] Generate output file
echo [R] Reset output file
echo [B] Back
set /p input= "Enter Menu Option: "
if %input% == B (goto :menu) else if %input% == b (goto :menu
) else if %input% == T (goto :toggle) else if %input% == t (goto :toggle
) else if %input% == I (goto :input_file) else if %input% == i (goto :input_file
) else if %input% == G (goto :output_file) else if %input% == g (goto :output_file
) else if %input% == R (goto :reset_output) else if %input% == r (goto :reset_output)
goto :settings
:toggle
if %toggle% == "true" (set toggle= "false") else (set toggle= "true")
goto :settings
:input_file
cls
echo --Set Input File--
set /p file= "Enter File Path from %CD% "
set toggle= "true"
echo %file%
goto :settings
:output_file
cls
echo --Generating output file to %CD%--
echo nilakantha algorithm performance test > out.txt
echo/ >> out.txt
if exist C/out.part (
echo --C-- >> out.txt
cd C
type out.part >> ../out.txt
cd..
)
if exist C++/out.part (
echo --C++-- >> out.txt
cd C++
type out.part >> ../out.txt
cd..
)
if exist python/out.part (
echo --python-- >> out.txt
cd python
type out.part >> ../out.txt
cd..
)
if exist ruby/out.part (
echo --ruby-- >> out.txt
cd ruby
type out.part >> ../out.txt
cd..
)
if exist js/out.part (
echo --JavaScript-- >> out.txt
cd js
type out.part >> ../out.txt
cd..
)
pause
goto :settings
:reset_output
del "%CD%\C\out.part"
del "%CD%\C++\out.part"
del "%CD%\python\out.part"
del "%CD%\ruby\out.part"
del "%CD%\js\out.part"
cls
echo --Deleted all program-specific output files--
pause
goto :settings
:main
echo/
echo --MENU--
echo [1] C
echo [2] C++
echo [3] Python
echo [4] Ruby
echo [5] JavaScript
echo [B] Back
if %toggle% == "true" (
if NOT %file% == "" (
set use_file= "true"
) else ( set use_file= "false" )
) else ( set use_file="false" )
set /p input= "Enter language: "
if %input% == 1 (
echo -------------------- C --------------------
) else if %input% == 2 (
echo -------------------- C++ --------------------
) else if %input% == 3 (
echo -------------------- Python --------------------
) else if %input% == 4 (
echo -------------------- Ruby --------------------
) else if %input% == 5 (
echo -------------------- JavaScript --------------------
) else if %input% == B (goto :menu) else if %input% == b (goto :menu
) else (
goto :main
)
echo/
goto :%input%
:1
cd C
if %use_file% == "true" ( nilakantha < ../%file%
) else ( nilakantha )
cd..
goto :main
:2
cd C++
if %use_file% == "true" ( nilakantha < ../%file%
) else ( nilakantha )
cd..
goto :main
:3
cd python
if %use_file% == "true" ( python -i nilakantha.py < ../%file%
) else ( python -i nilakantha.py )
cd..
goto :main
:4
cd ruby
if %use_file% == "true" ( ruby nilakantha.rb < ../%file%
) else ( ruby nilakantha.rb )
cd..
goto :main
:5
echo [1] Node.js
echo [2] Browser
echo [B] Back
set /p input= "Enter runtime: "
if %input% == 1 (
echo Node.js
echo/
cd js
if %use_file% == "true" ( node index-node.js < ../%file%
) else ( node index-node.js )
cd..
) else if %input% == 2 (
echo Browser
echo/
start js/index.html
) else if %input% == B (goto :main) else if %input% == b (goto :main
) else (goto :5)
goto :main