maxxon
6th March 2012, 23:51
Ever get a some sort of Avisynth error and you have to go to the file, find the line and then maybe do that for each of the calling functions?
Well I have. So I wrote a perl script to help out with this. It takes the standard output and massages it so that it will show just the functions you need.
Example (all examples have line numbers preceeding each line):
1 function a
2 {
3 b
4 }
5
6 function b
7 {
8 function c
9 {
10 d("""assert(false, "HELP ME!")""")
11 }
12
13 "c".eval
14 }
15
16 function d(string e)
17 {
18 e.eval
19 }
20
21 c
22 a
23
When executed results in output to standard error:
1
2 Avisynth error:
3 HELP ME!
4 (a.avs, line 18)
5 (a.avs, line 10)
6 (a.avs, line 21)
7
Which is kinda useful, but you have to go back and forth between files and and functions. Pipeing the standard error to this perl script will get you:
1
2 Avisynth error:
3 HELP ME!
4 (a.avs, line 18)
5 function d(string e)
6 17 {
7 > 18 e.eval
8 19 }
9
10 (a.avs, line 10)
11 function c
12 9 {
13 > 10 d("""assert(false, "HELP ME!")""")
14 11 }
15
16 (a.avs, line 21)
17 a.avs
18 1 function a
19 5
20 6 function b
21 15
22 16 function d(string e)
23 20
24 > 21 c
25 22 a
26 23
For each stack frame listed, all lines for the function that is associated with the line in question are displayed with their line numbers. Any lines from functions contained within (except for the declaration) are ignored. An arrow is also placed where the stack frame was pointing for easy viewing.
You can download it from here on sourceforge (https://sourceforge.net/projects/avisynthlib/files/?). It is called parseErrors.pl. It works under wine and windows but requires perl to be available.
Hope this helps someone else too. :)
|\/|x
P.S. I have found instances where the stack frame displayed is incomplete. i.e. fn1 called fn2 which called fn3, but one is missing. I'm not sure why this happens, but it can be confusing. Please, if you can make a small test that can show this reliably, please post it.:thanks:
Well I have. So I wrote a perl script to help out with this. It takes the standard output and massages it so that it will show just the functions you need.
Example (all examples have line numbers preceeding each line):
1 function a
2 {
3 b
4 }
5
6 function b
7 {
8 function c
9 {
10 d("""assert(false, "HELP ME!")""")
11 }
12
13 "c".eval
14 }
15
16 function d(string e)
17 {
18 e.eval
19 }
20
21 c
22 a
23
When executed results in output to standard error:
1
2 Avisynth error:
3 HELP ME!
4 (a.avs, line 18)
5 (a.avs, line 10)
6 (a.avs, line 21)
7
Which is kinda useful, but you have to go back and forth between files and and functions. Pipeing the standard error to this perl script will get you:
1
2 Avisynth error:
3 HELP ME!
4 (a.avs, line 18)
5 function d(string e)
6 17 {
7 > 18 e.eval
8 19 }
9
10 (a.avs, line 10)
11 function c
12 9 {
13 > 10 d("""assert(false, "HELP ME!")""")
14 11 }
15
16 (a.avs, line 21)
17 a.avs
18 1 function a
19 5
20 6 function b
21 15
22 16 function d(string e)
23 20
24 > 21 c
25 22 a
26 23
For each stack frame listed, all lines for the function that is associated with the line in question are displayed with their line numbers. Any lines from functions contained within (except for the declaration) are ignored. An arrow is also placed where the stack frame was pointing for easy viewing.
You can download it from here on sourceforge (https://sourceforge.net/projects/avisynthlib/files/?). It is called parseErrors.pl. It works under wine and windows but requires perl to be available.
Hope this helps someone else too. :)
|\/|x
P.S. I have found instances where the stack frame displayed is incomplete. i.e. fn1 called fn2 which called fn3, but one is missing. I'm not sure why this happens, but it can be confusing. Please, if you can make a small test that can show this reliably, please post it.:thanks: