Skip to content

Commit 18c82dc

Browse files
committed
End of file func bug fix
Also fixed the "one function" problem. Now there can be .interOp files with only one function
1 parent 210f1c4 commit 18c82dc

3 files changed

Lines changed: 24 additions & 11 deletions

File tree

interOp.bat

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
C:/PROGRA~1/R/R-35~1.0/bin/Rscript.exe interpreter.R "mainScript.txt"
1+
set arg1=%1
2+
%__CD__%R-3.4.1\bin\Rscript.exe interpreter.R %arg1%
23
pause
34
cls
45
exit

interpreter.R

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,14 @@ loadScrit <- function(){
1818
}
1919
return(fileName)
2020
}
21-
if (!require("parallel")) install.packages("parallel") # The new parallel version requires library parallels
22-
library(parallel)
21+
if (!require("foreach")) install.packages("foreach", repos='http://cran.us.r-project.org') # The new parallel version requires library parallels
22+
library(foreach)
23+
2324
script <- suppressWarnings(readLines("mainScript.interOp")) #This triggers a warning but not an concern
25+
script <- suppressWarnings(readLines("scripts/r.interOp")) #This triggerss a warning but not an concern
26+
2427
# From loading from a file have to conver to table matrix
28+
#script <- suppressWarnings(readLines(loadScrit()))
2529
script <- as.matrix(script)
2630

2731
# Remove all comments #######THIS COULD ALL BE NOT WORKING BC YOU HAVENT REDEFINED IT AS A MATRIX?
@@ -69,6 +73,9 @@ processBounds <- function(){
6973
for( i in 1:length(script[,1])){
7074
bounds <- rbind(bounds, findBounds(script, startingVal = counter))
7175
counter <- findBounds(script, startingVal = counter)[2]
76+
if(is.null(counter)) {
77+
break()
78+
}
7279
if(counter == length(script[,1])){
7380
break
7481
}
@@ -80,7 +87,16 @@ processBounds <- function(){
8087
#Send Processing calls
8188

8289
allbounds <- processBounds()
83-
titleRows <- as.integer(allbounds[,1])
90+
# If there is only one function assigning a row wont always work
91+
# so we need to check first how many functions their are.
92+
if(length(allbounds) != 3) {
93+
titleRows <- as.integer(allbounds[,1])
94+
95+
} else if(length(allbounds) == 3 ) {
96+
titleRows <- as.integer(allbounds[,1])
97+
} else {
98+
print("faital script error")
99+
}
84100
source("processRequest.R")
85101

86102
Piper <- function(firstFunc, secondFunc){
@@ -148,10 +164,10 @@ master <- function(){
148164
}
149165
}
150166
}
151-
#start_time <- Sys.time()
167+
start_time <- Sys.time()
152168
master()
153-
#end_time <- Sys.time()
154-
#end_time - start_time
169+
end_time <- Sys.time()
170+
end_time - start_time
155171

156172

157173

mainScript.interOp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,3 @@ rtester **<< module2
145145
testRuby **<< module2
146146
goMod **<< module2
147147
luaTest **<< module2
148-
149-
moduleFun
150-
**js
151-
**/

0 commit comments

Comments
 (0)