[REBOL] File analysis
From: richard:coffre:francetelecom at: 22-Apr-2002 15:59
Hi Rebollers,
I have to study a Flash application. To do so I extract all the code with
Action Script Viewer and I got a Text File.
But now I want to find the code associated to each function and to create
for each function found a file with its code.
Hereafter a sample of the file.
The example that follows shows the link between the function "CalcDaysInFeb"
and its code located at "Symbol 317 MovieClip Frame 15".
TIA
rc
This sample below shows the link between a function and its name in the file
(this excerpt is located at the end of the file ) :
dummy
Symbol 316 MovieClip Frame 2
CheckDate
Symbol 317 MovieClip Frame 5
CalcDaysInFeb
Symbol 317 MovieClip Frame 15
FormatDate
Symbol 318 MovieClip Frame 5
CheckValid
Symbol 318 MovieClip Frame 15
DummyDate
Symbol 342 MovieClip Frame 15
Now this is the main part of the file where the code is defined :
----------------------------------------------------------------------
Symbol 317 MovieClip Frame 5
----------------------------------------------------------------------
Trace("In CheckDate")
Set Variable: "result" = ""
If (not (checkDay < 1) and not (31 < checkDay))
Trace(("Day " & checkDay) & " is valid")
If (not (checkMonth < 1) and not (12 < checkMonth))
Trace(("Month " & checkMonth) & " is valid")
If (Length (checkYear) = 4)
Trace(("Year " & checkYear) & " has 4 digits")
If (not (Eval("daysInMonth" & checkMonth) < checkDay))
Trace((("Day " & checkDay) & " <= ") &
Eval("daysInMonth" & checkMonth))
If (checkMonth = 2)
Call ("CalcDaysInFeb")
If (not (daysInFebruary < checkDay))
Set Variable: "result" = "ok"
End If
Else
Set Variable: "result" = "ok"
End If
End If
Else
Trace(("Year " & checkYear) & " is invalid")
End If
Else
Trace(("Month " & checkMonth) & " is invalid")
End If
Else
Trace(("Day " & checkDay) & " is invalid")
End If
----------------------------------------------------------------------
Symbol 317 MovieClip Frame 15
----------------------------------------------------------------------
Trace("Calculating days in Feb for " & checkYear)
Set Variable: "daysInFebruary" = 28
Set Variable: "divBy4" = 0
Set Variable: "divBy100" = 0
Set Variable: "divBy400" = 0
If ((checkYear / 4) = Int (checkYear / 4))
Trace(checkYear & " divisible by 4")
Set Variable: "divBy4" = 1
End If
If ((checkYear / 100) = Int (checkYear / 100))
Trace(checkYear & " divisible by 100")
Set Variable: "divBy100" = 1
End If
If ((checkYear / 400) = Int (checkYear / 400))
Trace(checkYear & " divisible by 400")
Set Variable: "divBy400" = 1
End If
If ((divBy4 = 1) and (not (divBy100 = 1) or (divBy400 = 1)))
Set Variable: "daysInFebruary" = 29
End If
Trace("daysInFebruary = " & daysInFebruary)
----------------------------------------------------------------------
Symbol 318 MovieClip Frame 1
----------------------------------------------------------------------
Stop
Set Variable: "pos1" = GetProperty ( "MonthMovie",_x )
Set Variable: "pos2" = GetProperty ( "DayMovie",_x )
Set Variable: "pos3" = GetProperty ( "YearMovie",_x )
Trace((((("pos 1 = " & pos1) & " pos2 = ") & pos2) & " pos3 = ") & pos3)
Set Variable: "dateFormat" = /Gen/UserConfig:dateFormat
Trace("dateFormat is " & dateFormat)
If (dateFormat eq "DMY")
Set Property ("DayMovie", X Position) = pos1
Set Property ("MonthMovie", X Position) = pos2
Else
If (dateFormat eq "MDY")
Set Property ("MonthMovie", X Position) = pos1
Set Property ("DayMovie", X Position) = pos2
End If
End If
----------------------------------------------------------------------
Symbol 318 MovieClip Frame 5
----------------------------------------------------------------------
Set Variable: "tmpYear" = (20 & YearMovie:value) & 0000
Richard Coffre
France Telecom Orbiscom
Tél. : 01 47 61 46 28
Share what you know, learn what you don't