Browse Source

fixed bugs and cleanup

Chris Cromer 2 years ago
parent
commit
78a6c2e6fa
6 changed files with 99 additions and 93 deletions
  1. 6
    0
      .idea/vcs.xml
  2. 4
    4
      check/script.js
  3. 3
    5
      index.css
  4. 38
    24
      index.html
  5. 19
    20
      js/jvon-angular.js
  6. 29
    40
      js/jvon-interpret.js

+ 6
- 0
.idea/vcs.xml View File

@@ -0,0 +1,6 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="VcsDirectoryMappings">
4
+    <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+  </component>
6
+</project>

+ 4
- 4
check/script.js View File

@@ -1,5 +1,5 @@
1
-var fileContents = new Array();
2
-var fileNames = new Array();
1
+var fileContents = [];
2
+var fileNames = [];
3 3
 
4 4
 function handleFileSelect(evt) {
5 5
     evt.stopPropagation();
@@ -46,8 +46,8 @@ function compareFiles(fileContents, fileNames) {
46 46
 }
47 47
 
48 48
 function resetArrays() {
49
-    fileNames = new Array();
50
-    fileContents = new Array();
49
+    fileNames = [];
50
+    fileContents = [];
51 51
 }
52 52
 
53 53
 function handleDragOver(evt) {

+ 3
- 5
index.css View File

@@ -67,7 +67,7 @@ body {
67 67
 }
68 68
 
69 69
 .scrollcode {
70
-	margin: 0px auto;
70
+	margin: 0 auto;
71 71
 	width: 100%;
72 72
 	height: 300px;
73 73
 	overflow: scroll;
@@ -75,11 +75,10 @@ body {
75 75
 }
76 76
 
77 77
 .scrollresult {
78
-	margin: 0px auto;
78
+	margin: 0 auto;
79 79
 	width: 100%;
80 80
 	height: 300px;
81 81
 	overflow: scroll;
82
-	overflow-x: scroll;
83 82
 }
84 83
 
85 84
 .input_prompt {
@@ -126,7 +125,7 @@ body {
126 125
 	text-align: center;
127 126
 	width: 100%;
128 127
 	color: #FF0000;
129
-	margin: 0px auto;
128
+	margin: 0 auto;
130 129
 }
131 130
 
132 131
 .blur {
@@ -137,7 +136,6 @@ body {
137 136
 	top: 0;
138 137
 	bottom: 0;
139 138
 	z-index: 900;
140
-	background-color: #000000;
141 139
 	opacity: 0.7;
142 140
 	visibility: hidden;
143 141
 }

+ 38
- 24
index.html View File

@@ -32,8 +32,7 @@
32 32
 
33 33
     <div id="input_prompt" class="input_prompt">
34 34
 	<span class="input_prompt_vertical">
35
-	    {{strings.input_value}}
36
-	    <input autocomplete="off" type="text" name="rda" id="rda" />
35
+	    <label for="rda">{{strings.input_value}}</label><input autocomplete="off" type="text" name="rda" id="rda"/>
37 36
 	    <input ng-click="rda_value_received();" type="button" value="Ingresar" />
38 37
 	</span>
39 38
     </div>
@@ -43,14 +42,19 @@
43 42
     <table class="title_table">
44 43
 	<tr>
45 44
 	    <td class="blank_title_cell"><img src="ubblogo.png" /></td>
46
-	    <td class="project_name">{{strings.project_name}} <input type="text" id="project_name" name="project_name" value="" /></td>
45
+		<td class="project_name"><label for="project_name">{{strings.project_name}} </label><input type="text"
46
+																								   id="project_name"
47
+																								   name="project_name"
48
+																								   value=""/></td>
47 49
 	    <td class="options">
48 50
 		<input ng-click="show_help();" type="button" value="{{strings.help}}" />
49
-		<select ng-change="change_language();" ng-model="language">
50
-		    <option value="0">{{strings.spanish}}</option>
51
-		    <option value="1">{{strings.english}}</option>
52
-		</select>
53
-	    </td>
51
+			<label>
52
+				<select ng-change="change_language();" ng-model="language">
53
+					<option value="0">{{strings.spanish}}</option>
54
+					<option value="1">{{strings.english}}</option>
55
+				</select>
56
+			</label>
57
+		</td>
54 58
 	</tr>
55 59
     </table>
56 60
     <br />
@@ -62,8 +66,16 @@
62 66
 		    <table align="center" class="table_background">
63 67
 			<tr ng-repeat="(key, line) in code_lines">
64 68
 			    <td id="line1_{{key}}" ng-click="select_line(key, false);" class="table_cell line_number_td" >{{line.line}}</td>
65
-			    <td id="line2_{{key}}" class="table_cell"><select ng-model="line.command" ng-options="command.name for command in commands"></select></td>
66
-			    <td id="line3_{{key}}" class="table_cell"><input type="text" ng-model="line.value" /></td>
69
+				<td id="line2_{{key}}" class="table_cell">
70
+					<label>
71
+						<select ng-model="line.command" ng-options="command.name for command in commands"></select>
72
+					</label>
73
+				</td>
74
+				<td id="line3_{{key}}" class="table_cell">
75
+					<label>
76
+						<input type="text" ng-model="line.value"/>
77
+					</label>
78
+				</td>
67 79
 			</tr>
68 80
 		    </table>
69 81
 		</div>
@@ -125,24 +137,26 @@
125 137
 		<input ng-click="execute_code();" id="execute_code" type="button" value="{{strings.execute_code}}" />
126 138
 		<input ng-click="pause_code();" id="pause_code" type="button" value="{{strings.pause_code}}" disabled="disabled" />
127 139
 		<input ng-click="stop_code();" id="stop_code" type="button" value="{{strings.stop_code}}" disabled="disabled" />
128
-		{{strings.interval}}
129
-		<select ng-change="change_speed();" ng-model="speed">
130
-		    <option value="0">0</option>
131
-		    <option value="1">1</option>
132
-		    <option value="2">2</option>
133
-		    <option value="3">3</option>
134
-		    <option value="4">4</option>
135
-		    <option value="5">5</option>
136
-		</select>
140
+			<label>
141
+				{{strings.interval}}
142
+				<select ng-change="change_speed();" ng-model="speed">
143
+					<option value="0">0</option>
144
+					<option value="1">1</option>
145
+					<option value="2">2</option>
146
+					<option value="3">3</option>
147
+					<option value="4">4</option>
148
+					<option value="5">5</option>
149
+				</select>
150
+			</label>
137 151
 	    </td>
138 152
 	</tr>
139 153
     </table>
140 154
     <div class="credits">
141
-	<b>JVON Web</b><br />
142
-	{{strings.credits_description}}&nbsp;<b>{{strings.credits_john}}</b><br />
143
-	{{strings.credits_cromer}}<br />
144
-	Ingeniería Civil en Informática, Universidad del Bío Bío, 2015<br />
145
-	<a target="_blank" href="jvon-1.0.0.0.apk">Version android</href>
155
+		<b>JVON Web</b><br/>
156
+		{{strings.credits_description}}&nbsp;<b>{{strings.credits_john}}</b><br/>
157
+		{{strings.credits_cromer}}<br/>
158
+		Ingeniería Civil en Informática, Universidad del Bío Bío, 2015<br/>
159
+		<a target="_blank" href="jvon-1.0.0.0.apk">Version android</a>
146 160
     </div>
147 161
 </body>
148 162
 </html>

+ 19
- 20
js/jvon-angular.js View File

@@ -1,4 +1,5 @@
1 1
 // This is the angular controller and the code pane
2
+//noinspection JSUnresolvedFunction
2 3
 var jvonapp = angular.module("JVON", ["ngTouch", "ngSanitize"]);
3 4
 
4 5
 jvonapp.controller('JVONController', ["$scope", "$timeout", "$interval", function ($scope, $timeout ,$interval) {
@@ -6,13 +7,13 @@ jvonapp.controller('JVONController', ["$scope", "$timeout", "$interval", functio
6 7
 	$scope.commands = commands;
7 8
 
8 9
 	// The code pane
9
-	$scope.code_lines = new Array();
10
+	$scope.code_lines = [];
10 11
 
11 12
 	// The result pane
12
-	$scope.results = new Array();
13
+	$scope.results = [];
13 14
 
14 15
 	// What is displayed on the screen
15
-	$scope.screen = new Array();
16
+	$scope.screen = [];
16 17
 
17 18
 	$scope.execution_started = false;
18 19
 
@@ -67,14 +68,14 @@ jvonapp.controller('JVONController', ["$scope", "$timeout", "$interval", functio
67 68
 		}
68 69
 		else {
69 70
 			$interval.cancel($scope.blink_promise);
70
-			element = document.getElementById("pause_code");
71
+			var element = document.getElementById("pause_code");
71 72
 			element.style.opacity = 1;
72
-			element.style.filter = "alpha(opacity=" + 1 * 100 + ")";
73
+			element.style.filter = "alpha(opacity=100)";
73 74
 		}
74 75
 	};
75 76
 
76 77
 	$scope.blink = function () {
77
-		element = document.getElementById("pause_code");
78
+		var element = document.getElementById("pause_code");
78 79
 		if ($scope.blink_state == false) {
79 80
 			if ($scope.opacity <= 0.1) {
80 81
 				$scope.blink_state = true;
@@ -177,7 +178,8 @@ jvonapp.controller('JVONController', ["$scope", "$timeout", "$interval", functio
177 178
 		if ($scope.code_lines.length > 0) {
178 179
 			// Find the last highlighted line
179 180
 			var highlighted = null;
180
-			for (var i = $scope.code_lines.length - 1; i >= 0; i--) {
181
+			var i;
182
+			for (i = $scope.code_lines.length - 1; i >= 0; i--) {
181 183
 				if ($scope.code_lines[i].highlighted == true) {
182 184
 					highlighted = i;
183 185
 					break;
@@ -188,9 +190,9 @@ jvonapp.controller('JVONController', ["$scope", "$timeout", "$interval", functio
188 190
 			}
189 191
 
190 192
 			// Add a line after the last highlighted
191
-			var new_code_lines = new Array();
193
+			var new_code_lines = [];
192 194
 			var j = 1;
193
-			for (var i = 0; i < $scope.code_lines.length; i++) {
195
+			for (i = 0; i < $scope.code_lines.length; i++) {
194 196
 				if (highlighted == i) {
195 197
 					$scope.code_lines[i].line = j.toString();
196 198
 					new_code_lines.push($scope.code_lines[i]);
@@ -217,7 +219,7 @@ jvonapp.controller('JVONController', ["$scope", "$timeout", "$interval", functio
217 219
 
218 220
 	// Delete the highlighted lines
219 221
 	$scope.delete_line = function () {
220
-		var new_code_lines = new Array();
222
+		var new_code_lines = [];
221 223
 		var j = 1;
222 224
 		for (var i = 0; i < $scope.code_lines.length; i++) {
223 225
 			if (!$scope.code_lines[i].highlighted) {
@@ -231,17 +233,18 @@ jvonapp.controller('JVONController', ["$scope", "$timeout", "$interval", functio
231 233
 
232 234
 	// Delete all code lines
233 235
 	$scope.clear_code = function () {
234
-		$scope.code_lines = new Array();
236
+		$scope.code_lines = [];
235 237
 	};
236 238
 
237 239
 	$scope.select_line = function (line_number, result) {
240
+		var line;
241
+		
238 242
 		// If execution finished remove all highlights
239 243
 		if ($scope.finished == true) {
240 244
 			$scope.finished = false;
241 245
 			for (var i = 0; i < $scope.code_lines.length; i++) {
242 246
 				if ($scope.code_lines[i].highlighted == true) {
243 247
 					// Unhighlight
244
-					var line;
245 248
 					line = document.getElementById("line1_" + i.toString());
246 249
 					line.className = line.className.substring(0,line.className.length - 21);
247 250
 					line = document.getElementById("line2_" + i.toString());
@@ -256,7 +259,6 @@ jvonapp.controller('JVONController', ["$scope", "$timeout", "$interval", functio
256 259
 		if ($scope.executing == true && result == true) {
257 260
 			if ($scope.code_lines[line_number].highlighted == false) {
258 261
 				// Highlight
259
-				var line;
260 262
 				line = document.getElementById("line1_" + line_number.toString());
261 263
 				line.className += " code_number_selected";
262 264
 				line = document.getElementById("line2_" + line_number.toString());
@@ -267,7 +269,6 @@ jvonapp.controller('JVONController', ["$scope", "$timeout", "$interval", functio
267 269
 			}
268 270
 			else {
269 271
 				// Unhighlight
270
-				var line;
271 272
 				line = document.getElementById("line1_" + line_number.toString());
272 273
 				line.className = line.className.substring(0,line.className.length - 21);
273 274
 				line = document.getElementById("line2_" + line_number.toString());
@@ -280,7 +281,6 @@ jvonapp.controller('JVONController', ["$scope", "$timeout", "$interval", functio
280 281
 		else if ($scope.executing == false && result == false) {
281 282
 			if ($scope.code_lines[line_number].highlighted == false) {
282 283
 				// Highlight
283
-				var line;
284 284
 				line = document.getElementById("line1_" + line_number.toString());
285 285
 				line.className += " line_number_selected";
286 286
 				line = document.getElementById("line2_" + line_number.toString());
@@ -291,7 +291,6 @@ jvonapp.controller('JVONController', ["$scope", "$timeout", "$interval", functio
291 291
 			}
292 292
 			else {
293 293
 				// Unhighlight
294
-				var line;
295 294
 				line = document.getElementById("line1_" + line_number.toString());
296 295
 				line.className = line.className.substring(0,line.className.length - 21);
297 296
 				line = document.getElementById("line2_" + line_number.toString());
@@ -380,7 +379,7 @@ jvonapp.controller('JVONController', ["$scope", "$timeout", "$interval", functio
380 379
 	};
381 380
 
382 381
 	// Watch for changes to the code from external sources and update accordingly
383
-	$scope.$watch('imported_code',function(newValue, oldValue) {
382
+	$scope.$watch('imported_code', function (newValue) {
384 383
 		if (newValue) {
385 384
 			$scope.code_lines = newValue;
386 385
 			$scope.imported_code = false;
@@ -417,7 +416,7 @@ jvonapp.controller('JVONController', ["$scope", "$timeout", "$interval", functio
417 416
 jvonapp.directive("importFile", function () {
418 417
 	return {
419 418
 		restrict: "A",
420
-		link: function ($scope, element, attributes) {
419
+		link: function ($scope, element) {
421 420
 			element.bind('change', function (event) {
422 421
 				var file = event.target.files[0];
423 422
 
@@ -435,9 +434,9 @@ jvonapp.directive("importFile", function () {
435 434
 								$scope.select_line(i, true);
436 435
 							}
437 436
 						}
438
-						$scope.code_lines = new Array();
437
+						$scope.code_lines = [];
439 438
 						$scope.$apply();
440
-					}
439
+					};
441 440
 
442 441
 					reader.readAsText(file);
443 442
 				}

+ 29
- 40
js/jvon-interpret.js View File

@@ -18,7 +18,7 @@ document.addEventListener('DOMContentLoaded', function () {
18 18
             $scope.finished = false;
19 19
 
20 20
             $scope.ac = "";
21
-            $scope.memory = new Array();
21
+			$scope.memory = [];
22 22
             $scope.memory[0] = null; // 80
23 23
             $scope.memory[1] = null; // 81
24 24
             $scope.memory[2] = null; // 82
@@ -39,8 +39,8 @@ document.addEventListener('DOMContentLoaded', function () {
39 39
 
40 40
             $scope.disable_code_buttons();
41 41
 
42
-            $scope.results = new Array();
43
-            $scope.screen = new Array();
42
+			$scope.results = [];
43
+			$scope.screen = [];
44 44
             $scope.line_number = 0;
45 45
             $scope.repeater();
46 46
         }
@@ -135,7 +135,7 @@ document.addEventListener('DOMContentLoaded', function () {
135 135
                         $scope.pow($scope.code_lines[$scope.line_number].value);
136 136
                         break;
137 137
                     case "End":
138
-                        $scope.End($scope.code_lines[$scope.line_number].value);
138
+						$scope.End();
139 139
                         break;
140 140
                     default:
141 141
                         alert($scope.code_lines[$scope.line_number].command.name + " is not implemented yet.");
@@ -148,12 +148,13 @@ document.addEventListener('DOMContentLoaded', function () {
148 148
 
149 149
     $scope.check_syntax = function (value) {
150 150
         var result;
151
+		var regex;
151 152
 
152 153
         if (value == "") {
153 154
             return {type: "blank", value: ""};
154 155
         }
155 156
 
156
-        var regex = /^(\d+)$/;
157
+		regex = /^(\d+)$/;
157 158
         if ((result = regex.exec(value)) !== null) {
158 159
             if (result.index === regex.lastIndex) {
159 160
                 regex.lastIndex++;
@@ -162,7 +163,7 @@ document.addEventListener('DOMContentLoaded', function () {
162 163
             return {type: "memory", value: result[1]};
163 164
         }
164 165
 
165
-        var regex = /^\[(\d+)\]$/;
166
+		regex = /^\[(\d+)]$/;
166 167
         if ((result = regex.exec(value)) !== null) {
167 168
             if (result.index === regex.lastIndex) {
168 169
                 regex.lastIndex++;
@@ -171,7 +172,7 @@ document.addEventListener('DOMContentLoaded', function () {
171 172
             return {type: "address", value: result[1]};
172 173
         }
173 174
 
174
-        var regex = /^#(-?[0-9]*?\.?[0-9]+)$/;
175
+		regex = /^#(-?[0-9]*?\.?[0-9]+)$/;
175 176
         if ((result = regex.exec(value)) !== null) {
176 177
             if (result.index === regex.lastIndex) {
177 178
                 regex.lastIndex++;
@@ -185,18 +186,12 @@ document.addEventListener('DOMContentLoaded', function () {
185 186
 
186 187
     $scope.check_memory_address = function(value) {
187 188
         value = parseFloat(value);
188
-        if (value < 80 || value > 85) {
189
-            return false;
190
-        }
191
-        return true;
189
+		return !(value < 80 || value > 85);
192 190
     };
193 191
 
194 192
     $scope.check_memory_value = function(value) {
195 193
         value = parseFloat(value) - 80;
196
-        if ($scope.memory[value] == null) {
197
-            return false;
198
-        }
199
-        return true;
194
+		return $scope.memory[value] != null;
200 195
     };
201 196
 
202 197
     $scope.rda = function (value) {
@@ -223,9 +218,8 @@ document.addEventListener('DOMContentLoaded', function () {
223 218
                 var new_memory = $scope.memory[syntax.value];
224 219
 
225 220
                 var regex = /^\d+$/;
226
-                var result;
227 221
 
228
-                if ((result = regex.exec(new_memory)) !== null && $scope.check_memory_address(new_memory) == true) {
222
+				if (regex.exec(new_memory) !== null && $scope.check_memory_address(new_memory) == true) {
229 223
                     $scope.rda_value = new_memory;
230 224
                     $scope.show_input_prompt();
231 225
                 }
@@ -245,9 +239,8 @@ document.addEventListener('DOMContentLoaded', function () {
245 239
         var value = document.getElementById("rda").value;
246 240
 
247 241
         var regex = /^-?[0-9]*?\.?[0-9]+$/;
248
-        var result;
249 242
 
250
-        if ((result = regex.exec(value)) !== null) {
243
+		if (regex.exec(value) !== null) {
251 244
             value = parseFloat(value);
252 245
             $scope.rda_value = parseFloat($scope.rda_value);
253 246
 
@@ -329,7 +322,7 @@ document.addEventListener('DOMContentLoaded', function () {
329 322
         }
330 323
         else if (syntax.type == "memory") {
331 324
             if ($scope.check_memory_address(value) == true) {
332
-                new_value = parseFloat(value) - 80;
325
+				var new_value = parseFloat(value) - 80;
333 326
                 $scope.memory[new_value] = $scope.ac;
334 327
 
335 328
                 $scope.create_result($scope.line_number, parseFloat(value), $scope.ac);
@@ -350,9 +343,8 @@ document.addEventListener('DOMContentLoaded', function () {
350 343
                 var new_memory = $scope.memory[syntax.value];
351 344
 
352 345
                 var regex = /^\d+$/;
353
-                var result;
354 346
 
355
-                if ((result = regex.exec(new_memory)) !== null && $scope.check_memory_address(new_memory) == true) {
347
+				if (regex.exec(new_memory) !== null && $scope.check_memory_address(new_memory) == true) {
356 348
                     new_memory = parseFloat(new_memory) - 80;
357 349
                     $scope.memory[new_memory] = $scope.ac;
358 350
 
@@ -519,13 +511,13 @@ document.addEventListener('DOMContentLoaded', function () {
519 511
 
520 512
     $scope.div = function (value) {
521 513
         var syntax = $scope.check_syntax(value);
514
+		var regex;
522 515
         if (syntax.type == "number") {
523 516
             $scope.ac = parseFloat($scope.ac) / parseFloat(syntax.value);
524 517
 
525
-            var regex = /^-?[0-9]*\.?[0-9]+$/;
526
-            var result;
518
+			regex = /^-?[0-9]*\.?[0-9]+$/;
527 519
 
528
-            if ((result = regex.exec($scope.ac)) !== null) {
520
+			if (regex.exec($scope.ac) !== null) {
529 521
                 $scope.create_result($scope.line_number, "ac", $scope.ac);
530 522
                 $scope.line_number++;
531 523
                 $scope.repeater();
@@ -540,10 +532,9 @@ document.addEventListener('DOMContentLoaded', function () {
540 532
                 value = $scope.memory[value - 80];
541 533
                 $scope.ac = parseFloat($scope.ac) / parseFloat(value);
542 534
 
543
-				var regex = /^-?[0-9]*\.?[0-9]+$/;
544
-                var result;
535
+				regex = /^-?[0-9]*\.?[0-9]+$/;
545 536
 
546
-                if ((result = regex.exec($scope.ac)) !== null) {
537
+				if (regex.exec($scope.ac) !== null) {
547 538
                     $scope.create_result($scope.line_number, "ac", $scope.ac);
548 539
                     $scope.line_number++;
549 540
                     $scope.repeater();
@@ -564,10 +555,9 @@ document.addEventListener('DOMContentLoaded', function () {
564 555
                 value = parseFloat($scope.memory[temp_value - 80]);
565 556
                 $scope.ac = parseFloat($scope.ac) / value;
566 557
 
567
-                var regex = /^-?[0-9]*\.?[0-9]+$/;
568
-                var result;
558
+				regex = /^-?[0-9]*\.?[0-9]+$/;
569 559
 
570
-                if ((result = regex.exec($scope.ac)) !== null) {
560
+				if (regex.exec($scope.ac) !== null) {
571 561
                     $scope.create_result($scope.line_number, "ac", $scope.ac);
572 562
                     $scope.line_number++;
573 563
                     $scope.repeater();
@@ -686,13 +676,14 @@ document.addEventListener('DOMContentLoaded', function () {
686 676
 
687 677
     $scope.sqr = function (value) {
688 678
         var syntax = $scope.check_syntax(value);
679
+		var sqr;
689 680
         if (syntax.type == "blank") {
690 681
             if ($scope.ac == "") {
691 682
                 alert($scope.strings.error_ac);
692 683
                 $scope.stop_code();
693 684
             }
694 685
             else {
695
-                var sqr = Math.sqrt(parseFloat($scope.ac));
686
+				sqr = Math.sqrt(parseFloat($scope.ac));
696 687
                 if (sqr == "NaN") {
697 688
                     alert($scope.strings.error_math);
698 689
                     $scope.stop_code();
@@ -706,7 +697,7 @@ document.addEventListener('DOMContentLoaded', function () {
706 697
             }
707 698
         }
708 699
         else if (syntax.type == "number") {
709
-            var sqr = Math.sqrt(syntax.value);
700
+			sqr = Math.sqrt(parseFloat(syntax.value));
710 701
             if (sqr == "NaN") {
711 702
                 alert($scope.strings.error_math);
712 703
                 $scope.stop_code();
@@ -721,7 +712,7 @@ document.addEventListener('DOMContentLoaded', function () {
721 712
         else if (syntax.type == "memory") {
722 713
             if ($scope.check_memory_address(value) == true && $scope.check_memory_value(value) == true) {
723 714
                 value = parseFloat($scope.memory[value - 80]);
724
-                var sqr = Math.sqrt(value);
715
+				sqr = Math.sqrt(value);
725 716
                 if (sqr == "NaN") {
726 717
                     alert($scope.strings.error_math);
727 718
                     $scope.stop_code();
@@ -742,7 +733,7 @@ document.addEventListener('DOMContentLoaded', function () {
742 733
             var temp_value = $scope.memory[syntax.value - 80];
743 734
             if ($scope.check_memory_address(temp_value) == true && $scope.check_memory_value(temp_value) == true) {
744 735
                 value = parseFloat($scope.memory[temp_value - 80]);
745
-                var sqr = Math.sqrt(value);
736
+				sqr = Math.sqrt(value);
746 737
                 if (sqr == "NaN") {
747 738
                     alert($scope.strings.error_math);
748 739
                     $scope.stop_code();
@@ -767,9 +758,9 @@ document.addEventListener('DOMContentLoaded', function () {
767 758
 
768 759
     $scope.pow = function (value) {
769 760
         var syntax = $scope.check_syntax(value);
761
+		var new_value;
770 762
         if (syntax.type == "number") {
771 763
             if ($scope.ac != "" || $scope.ac == 0) {
772
-                var new_value;
773 764
                 value = parseFloat(syntax.value);
774 765
                 if (value < 0) {
775 766
                     // The exponent is negative
@@ -793,7 +784,6 @@ document.addEventListener('DOMContentLoaded', function () {
793 784
         else if (syntax.type == "memory") {
794 785
             if ($scope.check_memory_address(value) == true) {
795 786
                 value = parseFloat($scope.memory[value - 80]);
796
-                var new_value;
797 787
                 if (value < 0) {
798 788
                     // The exponent is negative
799 789
                     value = Math.abs(parseFloat(value));
@@ -817,7 +807,6 @@ document.addEventListener('DOMContentLoaded', function () {
817 807
             var temp_value = $scope.memory[syntax.value - 80];
818 808
             if ($scope.check_memory_address(temp_value) == true) {
819 809
                 value = parseFloat($scope.memory[temp_value - 80]);
820
-                var new_value;
821 810
                 if (value < 0) {
822 811
                     // The exponent is negative
823 812
                     value = Math.abs(parseFloat(value));
@@ -850,9 +839,9 @@ document.addEventListener('DOMContentLoaded', function () {
850 839
         else {
851 840
             return base * $scope.pow_repeat(exponent -1, base);
852 841
         }
853
-    }
842
+	};
854 843
 
855
-    $scope.End = function (value) {
844
+	$scope.End = function () {
856 845
         // Rap-up everything
857 846
         $scope.stop_code();
858 847
     };

Loading…
Cancel
Save