01-13-2011
I usually deal with such parsing tasks with a little state machine that normlizes the C into one string block with all white space down to one or zero spaces as allowed. The state machine parses bytes until the end of declaration, knowing when it is in comments and in quotes, and the depth of any (){}[] has cancelled down to 0. The block might get very big, so it might be good to abstract out whatever is in {}, as you must reparse inside {} to see what is declared there. The code needs to be preprocessed so macros are expanded, and the parser needs to keep track of the files and line numbers it is in via include: # line_number "file_name"
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
Is there a way to determine if a Script is called from a
CRON job or from a commandline
Gerry. (2 Replies)
Discussion started by: jerryMcguire
2 Replies
2. Shell Programming and Scripting
last week i started learning perl, so have limited skill and knowledge.
why isn't 'die' being called and the script exiting before the 'directory created' line?
if (! -d "$logdir") {
system "mkdir -p $logdir" || die print "\nERROR: release log directory creation failed - $logdir: $!\n";... (4 Replies)
Discussion started by: mjays
4 Replies
3. Shell Programming and Scripting
Hi,
First I will tell my objective of this function (function one).
I have a table for ex:
id passwd name
-- ------ -----
1 fdhgfs werwer
2 fsdfs sdfsdf
3 sdfs sdfsdf
4 fdsfs dssdf
. . .
.
.
.
The id, passwd and name are the arguments for another function say two. (1 Reply)
Discussion started by: mercuryshipzz
1 Replies
4. UNIX for Dummies Questions & Answers
I want to write a shell script which traverses a cpp file.
Suppose there is function fncn_name6 .. which is called by fncn_name5
which in turn called by fncn_name4 and so on .. in a single cpp class.
ie
fncn_name1
{
fncn_name2
{
fncn_name3
}
{
fncn_name4
}
}
so fncn_name1 is... (2 Replies)
Discussion started by: ultimatix
2 Replies
5. UNIX for Dummies Questions & Answers
i have taken a screen shot of the question. http://www.magicscreenshot.com/MagicScreenshot/REAdbT956kE.png
Please some one help me.:) (1 Reply)
Discussion started by: kjamsheed
1 Replies
6. Programming
how?
there is html-page with:
<iframe>
<!--#exec cgi="perl-script"-->
</iframe>
so in that perl-script need to delegate the name of html-page
why? too lazy for ajax (3 Replies)
Discussion started by: tip78
3 Replies
7. Shell Programming and Scripting
I am using blow script :--
#!/bin/bash
FIND=$(ps -elf | grep "snmp_trap.sh" | grep -v grep) #check snmp_trap.sh is running or not
if
then
# echo "process found"
exit 0;
else
echo "process not found"
exec /home/Ketan_r /snmp_trap.sh 2>&1 & disown -h ... (1 Reply)
Discussion started by: ketanraut
1 Replies
8. Programming
I would like to use Perl in 'interactive' mode (kind off), starting it by
> perl -d -e 0;
But I need to have some function be read on loading.
Also, it should not be for anyone who starting Perl or use it any how.
I did try to search, but not much result.
I have try a file '.perldb':... (1 Reply)
Discussion started by: alex_5161
1 Replies
9. Shell Programming and Scripting
In the below script i found that the alias mkdir_s is getting invoked from function configure() i.e the alias is kicking in.
#!/bin/bash -e
shopt -s expand_aliases
alias mkdir=mkdir_s
mkdir_s(){
if ]; then
return
else
/usr/bin/mkdir "$1"
return
fi
}
configure()
{
mkdir -p... (9 Replies)
Discussion started by: mohtashims
9 Replies
10. UNIX for Beginners Questions & Answers
I want to find c function definition with pattern with shell script by checking condition for each line:
data_type
functionname(param_list){
....
}
I knew cscope or ctag is usable for this task, but if there any ways to do without using them.
I am thinking of checking line condition... (3 Replies)
Discussion started by: cmdcmd
3 Replies
LEARN ABOUT PHP
xml_set_unparsed_entity_decl_handler
XML_SET_UNPARSED_ENTITY_DECL_HANDLER(3) 1 XML_SET_UNPARSED_ENTITY_DECL_HANDLER(3)
xml_set_unparsed_entity_decl_handler - Set up unparsed entity declaration handler
SYNOPSIS
bool xml_set_unparsed_entity_decl_handler (resource $parser, callable $handler)
DESCRIPTION
Sets the unparsed entity declaration handler function for the XML parser $parser.
The $handler will be called if the XML parser encounters an external entity declaration with an NDATA declaration, like the following:
<!ENTITY <parameter>name</parameter> {<parameter>publicId</parameter> | <parameter>systemId</parameter>}
NDATA <parameter>notationName</parameter>
See section 4.2.2 of the XML 1.0 spec for the definition of notation declared external entities.
PARAMETERS
o $parser
- A reference to the XML parser to set up unparsed entity declaration handler function.
o $handler
-$handler is a string containing the name of a function that must exist when xml_parse(3) is called for $parser. The function
named by $handler must accept six parameters:
handler (resource $parser, string $entity_name, string $base, string $system_id, string $public_id, string $notation_name)
o $parser
- The first parameter, parser, is a reference to the XML parser calling the handler.
o $entity_name
- The name of the entity that is about to be defined.
o $base
- This is the base for resolving the system identifier ($systemId) of the external entity.Currently this parameter will
always be set to an empty string.
o $system_id
- System identifier for the external entity.
o $public_id
- Public identifier for the external entity.
o $notation_name
- Name of the notation of this entity (see xml_set_notation_decl_handler(3)).
If a handler function is set to an empty string, or FALSE, the handler in question is disabled.
Note
Instead of a function name, an array containing an object reference and a method name can also be supplied.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
PHP Documentation Group XML_SET_UNPARSED_ENTITY_DECL_HANDLER(3)