lineNumber = 0 lineValue = "" currentClass = "" currentMethod = "" function _ERRORMESSAGE (description) write (_STDERR, "Error at line ", lineNumber, ": ", lineValue, "\n") write (_STDERR, "In class: ", currentClass, "\n") write (_STDERR, "In method: ", currentMethod, "\n") write (_STDERR, description, "\n") end function readLine () lineNumber = lineNumber + 1 lineValue = read () return lineValue end function readClass (line) local a, b, class = strfind (line, "Class named: '([^']+)'") local x, y, superclass = strfind (readLine (), "superclass: '([^']+)'") currentClass = class currentMethod = "" readLine () -- indexedInstanceVariables instanceVariableNames = readLine () classVariableNames = readLine () readLine () -- sharedPools readLine () -- classInstanceVariableNames readLine () -- Annotation key: 'comment' local u, v, category = strfind (readLine (), "value: '([^']+)'") write (superclass, ' subclass: #', class, '\r') write (instanceVariableNames, '\r') write (classVariableNames, '\r') write (" poolDictionaries: ''\r") write (" category: '", category, "'!\r\r") end function readMethod (line) local a, b, class, method = strfind (line, '([^ ]+) +([^ !]+)!') local index, lines = 0, {} line = readLine () currentMethod = line while not strfind (line, 'Annotation') do lines [index] = line index = index + 1 line = readLine () end local x, y, category = strfind (line, "value: '([^']+)'") local date = date ("%m/%d/%Y %H:%M") if method == 'method' then write ("!", class, " methodsFor: '", category, "' stamp: 'lrs ", date, "'!\r") elseif method == 'classMethod' then write ("!", class, " class methodsFor: '", category, "' stamp: 'lrs ", date, "'!\r") end lines [getn (lines)] = lines [getn (lines)] .. ' !\r' for index, line in lines do write (line, '\r') end end function readSIF () write (date ("'From Squeak3.2gamma of %B %e, %Y on %e %B %Y at %I:%M:%S %p'!\r")) local line = readLine () while line do if strfind (line, 'Class named:') then readClass (line) elseif strfind (line, 'method!') or strfind (line, 'classMethod!') then readMethod (line) end line = readLine () end end readSIF ()