home *** CD-ROM | disk | FTP | other *** search
Wrap
on InitLogFile ErrToScreen global gErrLogFileObj, gEditorLanguage, gPrefsPath set gErrLogFileObj to FileIO(mnew, "READ", gPrefsPath & "Err.log") if objectp(gErrLogFileObj) then gErrLogFileObj(mdispose) set gErrLogFileObj to FileIO(mnew, "APPEND", gPrefsPath & "Err.log") else set gErrLogFileObj to FileIO(mnew, "WRITE", gPrefsPath & "Err.log") if objectp(gErrLogFileObj) then gErrLogFileObj(mWriteString, "================================================================================" & RETURN) gErrLogFileObj(mWriteString, " IVD Error's Log File" & RETURN & " Creation date :" && the long time & " " & the date & RETURN) gErrLogFileObj(mWriteString, "================================================================================" & RETURN & RETURN) end if end if if not objectp(gErrLogFileObj) and ErrToScreen then alert(getString(#ERRORLOGLINE1, gEditorLanguage) & gErrLogFileObj & getString(#ERRORLOGLINE2, gEditorLanguage) & RETURN) end if end on CloseError end on checkError ErrNo, ErrType, ErrToScreen, LogString, fatalErr global gErrLogFileObj, gNbErr, gLstError, gEditorLanguage if (the paramCount < 3) or (the paramCount > 5) then alert("CheckError : Erreur dans le nombre de parametres." & RETURN & RETURN & "Utilisation :" & RETURN & "CheckError(ErrNo,ErrType,ErrToScreen[,LogString])") if objectp(gErrLogFileObj) then gErrLogFileObj(mWriteString, the long time & " " & the date & RETURN & "-- Erreur dans le nombre de parametres." & RETURN & "-- Utilisation :" && "CheckError(ErrNo,ErrType,ErrToScreen[,LogString])" & RETURN & RETURN) end if set ReturnCode to 1 else if objectp(ErrNo) then set ReturnCode to 0 else if (ErrType = #RAM) or (ErrType = #AllocRAM) then if ((ErrNo > the freeBytes) and (ErrType = #RAM)) or ((ErrNo > (the memorysize / 1024)) and (ErrType = #AllocRAM)) then set ErrFound to ScanError(-1, ErrType) if ErrToScreen then alert(getString(#RAMERRORLINE1, gEditorLanguage) && getAt(gLstError, ErrFound + 2) & RETURN & RETURN & getString(#RAMERRORLINE2, gEditorLanguage) && Convert(ErrNo - the freeBytes) && getString(#RAMERRORLINE3, gEditorLanguage)) end if if objectp(gErrLogFileObj) then if (LogString <> EMPTY) and (the paramCount = 4) then gErrLogFileObj(mWriteString, the long time & " " & the date & " [" & LogString & "]" & RETURN) else gErrLogFileObj(mWriteString, the long time & " " & the date & RETURN) end if gErrLogFileObj(mWriteString, "--" && "Erreur RAM :" && getAt(gLstError, ErrFound + 2) & RETURN & "-- Vous avez besoin de" && Convert(ErrNo - the freeBytes) && "octets supplémentaires." & RETURN & RETURN) end if set ReturnCode to 1 else set ReturnCode to 0 end if else if ErrType = #QuickTime then if not (the quickTimePresent) then set ErrFound to ScanError(-1, ErrType) if ErrToScreen then alert(getAt(gLstError, ErrFound + 2) & RETURN) end if if objectp(gErrLogFileObj) then if (LogString <> EMPTY) and (the paramCount = 4) then gErrLogFileObj(mWriteString, the long time & " " & the date & " [" & LogString & "]" & RETURN) else gErrLogFileObj(mWriteString, the long time & " " & the date & RETURN) end if gErrLogFileObj(mWriteString, "--" && getAt(gLstError, ErrFound + 2) & RETURN & RETURN) end if set ReturnCode to 1 else set ReturnCode to 0 end if else if ErrType = #printer then set ErrFound to ScanError(-1, ErrType) if ErrToScreen then alert(getAt(gLstError, ErrFound + 2) & RETURN) end if if objectp(gErrLogFileObj) then if (LogString <> EMPTY) and (the paramCount = 4) then gErrLogFileObj(mWriteString, the long time & " " & the date & " [" & LogString & "]" & RETURN) else gErrLogFileObj(mWriteString, the long time & " " & the date & RETURN) end if gErrLogFileObj(mWriteString, "--" && getAt(gLstError, ErrFound + 2) & RETURN & RETURN) end if set ReturnCode to 1 else if ErrType = #DataBase then set ErrFound to ScanError(ErrNo, ErrType) if (ErrFound <> 0) and (getAt(gLstError, ErrFound + 2) <> EMPTY) then if ErrToScreen then alert(getAt(gLstError, ErrFound + 2) & RETURN) end if if objectp(gErrLogFileObj) then if (LogString <> EMPTY) and (the paramCount = 4) then gErrLogFileObj(mWriteString, the long time & " " & the date & " [" & LogString & "]" & RETURN) else gErrLogFileObj(mWriteString, the long time & " " & the date & RETURN) end if gErrLogFileObj(mWriteString, "--" && line 1 of getAt(gLstError, ErrFound + 2) & RETURN & RETURN) end if set ReturnCode to 1 else set ReturnCode to 0 end if else set ErrFound to ScanError(ErrNo, ErrType) if ErrFound <> 0 then if getAt(gLstError, ErrFound + 2) = EMPTY then set ReturnCode to 0 else if ErrToScreen then alert(getString(#ERROR, gEditorLanguage) && getAt(gLstError, ErrFound) && ": (" & getAt(gLstError, ErrFound + 1) & ")" && getAt(gLstError, ErrFound + 2)) end if if objectp(gErrLogFileObj) then if (LogString <> EMPTY) and (the paramCount = 4) then gErrLogFileObj(mWriteString, the long time & " " & the date & " [" & LogString & "]" & RETURN) else gErrLogFileObj(mWriteString, the long time & " " & the date & RETURN) end if gErrLogFileObj(mWriteString, "--" && "Erreur" && getAt(gLstError, ErrFound) && ": (" & getAt(gLstError, ErrFound + 1) & ")" && getAt(gLstError, ErrFound + 2) & RETURN & RETURN) end if set ReturnCode to 1 end if else if ErrToScreen then alert(string(ErrType) && getString(#ERRORUNKNOWN, gEditorLanguage)) end if if objectp(gErrLogFileObj) then gErrLogFileObj(mWriteString, the long time & " " & the date & RETURN & "--" && string(ErrType) && ": Erreur inconnue..." & RETURN & "-- Parametres recus par CheckError:" && ErrNo && "," && ErrType & "," && ErrToScreen) if the paramCount = 4 then gErrLogFileObj(mWriteString, "," && numToChar(34) & LogString & numToChar(34) & "." & RETURN & RETURN) else gErrLogFileObj(mWriteString, "." & RETURN & RETURN) end if end if set ReturnCode to 1 end if end if end if end if end if end if end if if (ReturnCode = 1) and fatalErr then quit() else return ReturnCode end if end on ScanError ENo, EType global gNbErr, gLstError set EFound to 0 repeat with i = 1 to gNbErr if (getAt(gLstError, ((i - 1) * 3) + 1) = EType) and (getAt(gLstError, ((i - 1) * 3) + 2) = ENo) then set EFound to ((i - 1) * 3) + 1 set i to gNbErr + 1 end if end repeat return EFound end on Convert Num set Res to EMPTY set TheNum to string(Num) if offset(".", TheNum) <> 0 then set TheNum to chars(TheNum, 1, offset(".", TheNum) - 1) end if set len to length(TheNum) repeat with i = len down to 1 if ((i mod 3) = 0) and (i <> len) then set Res to Res & "," end if set Res to Res & chars(TheNum, 1, 1) set TheNum to chars(TheNum, 2, length(TheNum)) end repeat return Res end