ステップ数カウント
ステップ数を数えてください。ただし、何もソフトを入れてはいけません。と命令された時のVBScript。
c/c++/Java/Javascript対応。拡張子vbsで保存・実行。
option explicit dim fso, ws, regex, msg, arg set fso = createobject("scripting.filesystemobject") set ws = createobject("wscript.shell") set regex = new regexp regex.global = true for each arg in wscript.arguments msg = msg & exec(arg) next msgbox msg function exec(filename) dim count, count_on, file, line count = 0 count_on = true set file = fso.opentextfile(filename) do while not file.atendofstream line = file.readline if count_on then count = count + isCode(line) if instr(line, "/*") then count_on = false if instr(line, "*/") then count_on = true loop exec = filename & vbcrlf & "count = " & count & vbcrlf end function function isCode(line) dim matches isCode = 0 regex.pattern = "^( |\t)*//" ' //コメント set matches = regex.execute(line) if matches.count > 0 then exit function regex.pattern = "^( |\t)*/\*" ' /*コメント set matches = regex.execute(line) if matches.count > 0 then exit function regex.pattern = "^( |\t)*$" ' 空白行 set matches = regex.execute(line) if matches.count > 0 then exit function isCode = 1 end function