[Freeswitch-docs] Current Progress on Variables
Hi team, It's not all that useful yet, but I've attached a report that contains all variables the FreeSWITCH gets, accounting for constants that were #defined in the source. There are about 50 that my script wasn't able to interpret as variables. Either the script didn't pick up the constant or it was actual code and not a string. The report also does not account for variables that FreeSWITCH sets. I will work on those later. The catalog right now has 638 variables while the attached report has 774.
But many variables don't have #define statements and are used as literal strings in the code. On Feb 16, 2018 18:28, "Ryan Harris" <ryharris@airmail.cc> wrote:
Hi team,
It's not all that useful yet, but I've attached a report that contains all variables the FreeSWITCH gets, accounting for constants that were #defined in the source.
There are about 50 that my script wasn't able to interpret as variables. Either the script didn't pick up the constant or it was actual code and not a string.
The report also does not account for variables that FreeSWITCH sets. I will work on those later.
The catalog right now has 638 variables while the attached report has 774.
_______________________________________________ Freeswitch-docs mailing list Freeswitch-docs@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-docs
This is one of the things that caused me to pause. The core developers have enough to keep them busy without me bugging them to update Doxygen or git pull notes specifying things like this. But, I don’t have enough experience with C to decode what’s going on in the code a lot of times so I hit a wall. I’m pretty sure a script would just dump every variable declaration without context to inform of its use. I don’t know how to solve this problem. :-( Bote From: Freeswitch-docs [mailto:freeswitch-docs-bounces@lists.freeswitch.org] On Behalf Of Stanislav Sinyagin Sent: Friday, 16 February, 2018 13:56 To: FreeSWITCH Docs Team <freeswitch-docs@lists.freeswitch.org> Subject: Re: [Freeswitch-docs] Current Progress on Variables But many variables don't have #define statements and are used as literal strings in the code. On Feb 16, 2018 18:28, "Ryan Harris" <ryharris@airmail.cc <mailto:ryharris@airmail.cc> > wrote: Hi team, It's not all that useful yet, but I've attached a report that contains all variables the FreeSWITCH gets, accounting for constants that were #defined in the source. There are about 50 that my script wasn't able to interpret as variables. Either the script didn't pick up the constant or it was actual code and not a string. The report also does not account for variables that FreeSWITCH sets. I will work on those later. The catalog right now has 638 variables while the attached report has 774. _______________________________________________ Freeswitch-docs mailing list Freeswitch-docs@lists.freeswitch.org <mailto:Freeswitch-docs@lists.freeswitch.org> http://lists.freeswitch.org/mailman/listinfo/freeswitch-docs
On 02/16/2018 02:14 PM, Bote Man wrote:
This is one of the things that caused me to pause. The core developers have enough to keep them busy without me bugging them to update Doxygen or git pull notes specifying things like this. But, I don’t have enough experience with C to decode what’s going on in the code a lot of times so I hit a wall. I’m pretty sure a script would just dump every variable declaration without context to inform of its use.
I don’t know how to solve this problem. :-(
Bote
The script right now is spitting out links to the source code lines in question, so /some/ discovery is possible. Once this part is finished to completion, we'll get a better idea of what we know and what we don't. I have learned a little by reading the code, but I think the next step should be to try to figure out how to use the switch_log_printf and the log macros. Running through the code with log output might give us clues. Another way to inspect would be to subscribe and watch things change with one of the event_handlers. We might try exploring GDB to walk through each step. I'm not sure if it would tell us what we need to know, but it's worth trying. I have to say that going through the documentation has made me really appreciate all the work that people have done over the years. Imagine if FreeSWITCH weren't documented at all -- I know that I wouldn't even know what FreeSWITCH was! For anything we really can't figure out, it's best to set them aside. Maybe someone will come along who can explain. Or we will have to ask the core developers, with appropriate compensation, to document them. I'm not sure what compensation model, but I think the best way to have a complete documentation is a combination of our collaboration and appropriate compensation to the core developers.
don't forget switch_channel_var_true /b On Fri, Feb 16, 2018 at 3:45 PM, Ryan Harris <ryharris@airmail.cc> wrote:
On 02/16/2018 02:14 PM, Bote Man wrote:
This is one of the things that caused me to pause. The core developers have enough to keep them busy without me bugging them to update Doxygen or git pull notes specifying things like this. But, I don’t have enough experience with C to decode what’s going on in the code a lot of times so I hit a wall. I’m pretty sure a script would just dump every variable declaration without context to inform of its use.
I don’t know how to solve this problem. :-(
Bote
The script right now is spitting out links to the source code lines in question, so /some/ discovery is possible. Once this part is finished to completion, we'll get a better idea of what we know and what we don't.
I have learned a little by reading the code, but I think the next step should be to try to figure out how to use the switch_log_printf and the log macros. Running through the code with log output might give us clues.
Another way to inspect would be to subscribe and watch things change with one of the event_handlers.
We might try exploring GDB to walk through each step. I'm not sure if it would tell us what we need to know, but it's worth trying.
I have to say that going through the documentation has made me really appreciate all the work that people have done over the years. Imagine if FreeSWITCH weren't documented at all -- I know that I wouldn't even know what FreeSWITCH was!
For anything we really can't figure out, it's best to set them aside. Maybe someone will come along who can explain.
Or we will have to ask the core developers, with appropriate compensation, to document them. I'm not sure what compensation model, but I think the best way to have a complete documentation is a combination of our collaboration and appropriate compensation to the core developers.
_______________________________________________ Freeswitch-docs mailing list Freeswitch-docs@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-docs
-- Brian West | Co-founder and Developer Need Commercial support? email sales@freeswitch.com FreeSWITCH Solutions | 17345 Civic Drive #2531 Brookfield, WI 53045 <https://maps.google.com/?q=17345+Civic+Drive+%232531+Brookfield,+WI+53045&entry=gmail&source=g> Email: brian@freeswitch.com Mobile: 918-424-9378 Website: https://www.FreeSWITCH.com <https://www.freeswitch.com/> [image: color-facebook-96.png] <https://www.facebook.com/freeswitch/>[image: color-twitter-96.png] <https://twitter.com/freeswitch?ref_src=twsrc%5Egoogle%7Ctwcamp%5Eserp%7Ctwgr%5Eauthor>
On 02/16/2018 05:22 PM, Brian West wrote:
don't forget switch_channel_var_true
/b
Now at 794! Thanks I added switch_channel_var_true and switch_channel_set_variable: var_expr = r'(switch_channel_var_true|switch_channel_(get|set)_variable\w*)(\(\w+[\-*\>*\w*]*\,\s*(?P<variable>\"*\w+\"*))' We are now at a total of 1205!
On 02/16/2018 01:56 PM, Stanislav Sinyagin wrote:
But many variables don't have #define statements and are used as literal strings in the code.
To clarify, the strings are the first thing I did. The regex is pretty simple, although it will need some verification to make sure it's matching everything: var_expr = r'(switch_channel_get_variable\w*\(\w+[\-*\>*\w*]*\,\s*(?P<variable>\"*\w+\"*))' Then for the #define: cpp_expr = r'#define (?P<const>.+) (?P<val>.+)' First we pass over the whole source, headers and c source files included, looking for defines to create a "database" with the constants. Then we do a second pass matching on var_expr. It finds about ~1400 matches. If the variable is a string literal (we check for the presence of '"'), it gets stored in a "variable database" with references to the source file and line. If it's not surrounded by quotes, then we try to check if it's a constant. If that's the case, then we add that variable to our variable database (also with source file and line). Finally, the left overs... about 50 are marked as needing review. I have to investigate those.
participants (4)
-
Bote Man
-
Brian West
-
Ryan Harris
-
Stanislav Sinyagin