Skip to content

Commit d06e084

Browse files
committed
function renaming
1 parent eec5cc0 commit d06e084

8 files changed

Lines changed: 47 additions & 43 deletions

‎v3/iframe-embed-demo.html‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,9 @@
2727

2828
<iframe width="800" height="500" frameborder="0" src="//pythontutor.com/iframe-embed.html#code=function+Vector(x,+y)+%7B%0A++this.x+%3D+x%3B%0A++this.y+%3D+y%3B%0A%7D%0A%0AVector.prototype.plus+%3D+function(other)+%7B%0A++return+new+Vector(this.x+%2B+other.x,+this.y+%2B+other.y)%3B%0A%7D%3B%0A%0Avar+v1+%3D+new+Vector(1,+2)%3B%0Avar+v2+%3D+Vector(20,+30)%3B+//+whoops,+forgot+'new'&origin=opt-frontend.js&cumulative=false&heapPrimitives=false&textReferences=false&py=js&rawInputLstJSON=%5B%5D&curInstr=9&codeDivWidth=350&codeDivHeight=400"> </iframe>
2929

30+
<p/>
31+
32+
<iframe width="800" height="500" frameborder="0" src="//pythontutor.com/iframe-embed.html#code=require+'set'%0A%0Amy_array+%3D+%5B1,+2,+3,+'hello',+false,+true,+nil%5D%0Amy_hash+%3D+%7B'John'+%3D%3E+26,+'Jane'+%3D%3E+21,+'Jack'+%3D%3E+30%7D%0Amy_set+%3D+my_array.to_set%0A%0Amy_hash%5B'nested+array'%5D+%3D+my_array%0Amy_array%5B1%5D+%3D+%5B'a',+'b',+'c'%5D&origin=opt-frontend.js&cumulative=true&heapPrimitives=true&textReferences=true&py=ruby&rawInputLstJSON=%5B%5D&curInstr=3&codeDivWidth=350&codeDivHeight=400"> </iframe>
33+
3034
</body>
3135
</html>

‎v3/js/composingprograms.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ function executeCode(forceStartingInstr, forceRawInputLst) {
7979
showAllFrameLabels: true,
8080
}
8181

82-
executePythonCode(pyInputGetValue(),
83-
backend_script, backendOptionsObj,
84-
frontendOptionsObj,
85-
'pyOutputPane',
86-
optFinishSuccessfulExecution, handleUncaughtExceptionFunc);
82+
executeCodeAndCreateViz(pyInputGetValue(),
83+
backend_script, backendOptionsObj,
84+
frontendOptionsObj,
85+
'pyOutputPane',
86+
optFinishSuccessfulExecution, handleUncaughtExceptionFunc);
8787
}
8888

8989
$(document).ready(function() {

‎v3/js/csc108h.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ function executeCode(forceStartingInstr, forceRawInputLst) {
7979
updateOutputCallback: function() {$('#urlOutput,#embedCodeOutput').val('');},
8080
}
8181

82-
executePythonCode(pyInputGetValue(),
83-
backend_script, backendOptionsObj,
84-
frontendOptionsObj,
85-
'pyOutputPane',
86-
optFinishSuccessfulExecution, handleUncaughtExceptionFunc);
82+
executeCodeAndCreateViz(pyInputGetValue(),
83+
backend_script, backendOptionsObj,
84+
frontendOptionsObj,
85+
'pyOutputPane',
86+
optFinishSuccessfulExecution, handleUncaughtExceptionFunc);
8787
}
8888

8989
$(document).ready(function() {

‎v3/js/iframe-embed.js‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -145,16 +145,16 @@ $(document).ready(function() {
145145
if (forceStartingInstr) {
146146
frontendOptionsObj.startingInstruction = forceStartingInstr;
147147
}
148-
executePythonCode(preseededCode,
149-
backend_script, backendOptionsObj,
150-
frontendOptionsObj,
151-
'vizDiv',
152-
function() { // success
153-
if (resizeContainer)
154-
resizeContainerNow();
155-
myVisualizer.redrawConnectors();
156-
},
157-
NOP);
148+
executeCodeAndCreateViz(preseededCode,
149+
backend_script, backendOptionsObj,
150+
frontendOptionsObj,
151+
'vizDiv',
152+
function() { // success
153+
if (resizeContainer)
154+
resizeContainerNow();
155+
myVisualizer.redrawConnectors();
156+
},
157+
NOP);
158158
}
159159

160160

‎v3/js/matrixtutor.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,11 @@ $(document).ready(function() {
201201
}
202202
}
203203

204-
executePythonCode(allCod,
205-
backend_script, backendOptionsObj,
206-
frontendOptionsObj,
207-
'pyOutputPane',
208-
enterDisplayMode, handleUncaughtExceptionFunc);
204+
executeCodeAndCreateViz(allCod,
205+
backend_script, backendOptionsObj,
206+
frontendOptionsObj,
207+
'pyOutputPane',
208+
enterDisplayMode, handleUncaughtExceptionFunc);
209209
}
210210

211211
function executeCodeFromScratch() {

‎v3/js/opt-frontend-common.js‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,11 +1307,11 @@ function optFinishSuccessfulExecution() {
13071307

13081308

13091309
// TODO: cut reliance on the nasty rawInputLst global
1310-
function executePythonCode(pythonSourceCode,
1311-
backendScript, backendOptionsObj,
1312-
frontendOptionsObj,
1313-
outputDiv,
1314-
handleSuccessFunc, handleUncaughtExceptionFunc) {
1310+
function executeCodeAndCreateViz(codeToExec,
1311+
backendScript, backendOptionsObj,
1312+
frontendOptionsObj,
1313+
outputDiv,
1314+
handleSuccessFunc, handleUncaughtExceptionFunc) {
13151315

13161316
function execCallback(dataFromBackend) {
13171317
var trace = dataFromBackend.trace;
@@ -1497,7 +1497,7 @@ function executePythonCode(pythonSourceCode,
14971497
backendScript === ruby_backend_script) {
14981498
// hack! should just be a dummy script for logging only
14991499
$.get(backendScript,
1500-
{user_script : pythonSourceCode,
1500+
{user_script : codeToExec,
15011501
options_json: JSON.stringify(backendOptionsObj),
15021502
user_uuid: supports_html5_storage() ? localStorage.getItem('opt_uuid') : undefined,
15031503
// if we don't have any deltas, then don't bother sending deltaObj:
@@ -1512,14 +1512,14 @@ function executePythonCode(pythonSourceCode,
15121512
// The name of the callback parameter, as specified by the YQL service
15131513
jsonp: "callback",
15141514
dataType: "jsonp",
1515-
data: {user_script : pythonSourceCode,
1515+
data: {user_script : codeToExec,
15161516
options_json: JSON.stringify(backendOptionsObj)},
15171517
success: execCallback,
15181518
});
15191519
} else {
15201520
// Python 2 or 3
15211521
$.get(backendScript,
1522-
{user_script : pythonSourceCode,
1522+
{user_script : codeToExec,
15231523
raw_input_json: rawInputLst.length > 0 ? JSON.stringify(rawInputLst) : '',
15241524
options_json: JSON.stringify(backendOptionsObj),
15251525
user_uuid: supports_html5_storage() ? localStorage.getItem('opt_uuid') : undefined,

‎v3/js/opt-frontend.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,11 @@ function executeCode(forceStartingInstr, forceRawInputLst) {
159159
var frontendOptionsObj = getBaseFrontendOptionsObj();
160160
frontendOptionsObj.startingInstruction = startingInstruction;
161161

162-
executePythonCode(pyInputGetValue(),
163-
backend_script, backendOptionsObj,
164-
frontendOptionsObj,
165-
'pyOutputPane',
166-
optFinishSuccessfulExecution, handleUncaughtExceptionFunc);
162+
executeCodeAndCreateViz(pyInputGetValue(),
163+
backend_script, backendOptionsObj,
164+
frontendOptionsObj,
165+
'pyOutputPane',
166+
optFinishSuccessfulExecution, handleUncaughtExceptionFunc);
167167
}
168168

169169

‎v3/js/opt-office-mix.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@ function executeCode(forceStartingInstr, forceRawInputLst) {
9494
pyCrazyMode: false, holisticMode: false
9595
}
9696

97-
executePythonCode(pyInputGetValue(),
98-
backend_script, backendOptionsObj,
99-
frontendOptionsObj,
100-
'pyOutputPane',
101-
officeMixFinishSuccessfulExecution, handleUncaughtExceptionFunc);
97+
executeCodeAndCreateViz(pyInputGetValue(),
98+
backend_script, backendOptionsObj,
99+
frontendOptionsObj,
100+
'pyOutputPane',
101+
officeMixFinishSuccessfulExecution, handleUncaughtExceptionFunc);
102102
}
103103

104104

0 commit comments

Comments
 (0)