Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
moretimetothisfile = false
nmodules=0
do 'главный цикл
if not moretimetothisfile then
curfile = 0
else
Reason="Time limit temporarily disabled"
end if
if curfile = 0 then
for i=1 to nmodules
for j=1 to nfiles
if needmodule(j)=modules(i) then
'must be compilationstatus(j)=CMPL_WAIT
curfile=j
Reason="Required module found - "&modules(i)
exit for
end if
next
if curfile > 0 then exit for
next
end if
if curfile = 0 then
for j=1 to nfiles
if compilationstatus(j)=CMPL_FUTURE then
curfile=j
Reason="Next file in list"
exit for
end if
next
end if
if curfile = 0 then
for j=1 to nfiles
if compilationstatus(j)=CMPL_WAIT then
call MsgLog("err","Error!!! all files are in dependence")
Wscript.Quit 1
end if
next
call MsgLog("info","Bingo!!! all files are compiled")
exit do
end if
call MsgLog("info","File to compile: "&files(curfile)&" Reason: "&Reason)
'запускаем компилятор
Set oExec = WSHShell.Exec(files(curfile))
'здесь ждём.
'если слишком долго компилируется (больше ста секунд), выставляем флаг terminated
'весь вывод сохраняется в allInput
'
if allInput = "" then
allInput="(empty)"
end if
allInputsplit=split(allInput,chr(10))
'analyzing dependence
modulerequired=false
moretimetothisfile = false
for j=0 to ubound(allInputsplit)
call MsgLog("info",allInputsplit(j))
next
for j=0 to ubound(allInputsplit)
if terminated and instr(allInputsplit(j),"ifort: error #10273:") then
'terminated wrongly
moretimetothisfile = true
call MsgLog("info","Premature termination detected")
else
'дальнейший анализ вывода.
'определили, что нужен модуль modulename
needmodule(curfile)=modulename
compilationstatus(curfile)=CMPL_WAIT
call MsgLog("info","Dependence found: "&needmodule(curfile))
modulerequired=true
exit for
end if
next 'j
if not modulerequired and not terminated then
needmodule(curfile)=""
compilationstatus(curfile)=CMPL_DONE
call MsgLog("info","Successfully compiled")
forderout.writeline mid(files(curfile),instrrev(files(curfile)," ")+1) 'assuming no quotes
end if
'здесь определяем созданные модули на основе созданных файлов (массив modules)
'newfound будет true, если создались новые файлы
'
if compilationstatus(curfile) = CMPL_DONE and not newfound then
call MsgLog("info","Nothing generated after successful compilation")
for j=0 to ubound(allInputsplit)
call MsgLog("info",allInputsplit(j))
next
Wscript.Quit 1
end if
loop 'конец главного цикла
Компиляция программного проекта на Fortran