473,388 Members | 1,213 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

How to remove specific function calls from source code...

Hi.
I writing a lot of code that contains calls to my own Debug functions
(like log).
I want to produce a release from my code without this function calls,
so I tried to write a program that reads a source code and removes this
function calls with preg_replace...
And here is a problem. I can't write a proper regexp for this use.

There are some call that contains more that one argument or arguments
are created dynamicaly, like:

log($myVar1, $myVar2. " -". $myVar3, "(x:". $x .", y:". $y .")",
$arg1.';('.$arg2.');'.$arg3);

Can anyone help me with it? I'm not good in Regular Expresions so maybe
I can learn something from this group ;)

Sep 7 '06 #1
3 1321
<ro********@gazeta.plwrote in message
news:11*********************@p79g2000cwp.googlegro ups.com...
Hi.
I writing a lot of code that contains calls to my own Debug functions
(like log).
I want to produce a release from my code without this function calls,
so I tried to write a program that reads a source code and removes this
function calls with preg_replace...
And here is a problem. I can't write a proper regexp for this use.

There are some call that contains more that one argument or arguments
are created dynamicaly, like:

log($myVar1, $myVar2. " -". $myVar3, "(x:". $x .", y:". $y .")",
$arg1.';('.$arg2.');'.$arg3);

Can anyone help me with it? I'm not good in Regular Expresions so maybe
I can learn something from this group ;)

Why not just change the debug function not to work?

--
"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
http://outolempi.net/ahdistus/ - Satunnaisesti päivittyvä nettisarjis
sp**@outolempi.net || Gedoon-S @ IRCnet || rot13(xv***@bhgbyrzcv.arg)
Sep 7 '06 #2

Kimmo Laine wrote:
<ro********@gazeta.plwrote in message
news:11*********************@p79g2000cwp.googlegro ups.com...
Hi.
I writing a lot of code that contains calls to my own Debug functions
(like log).
I want to produce a release from my code without this function calls,
so I tried to write a program that reads a source code and removes this
function calls with preg_replace...
And here is a problem. I can't write a proper regexp for this use.

There are some call that contains more that one argument or arguments
are created dynamicaly, like:

log($myVar1, $myVar2. " -". $myVar3, "(x:". $x .", y:". $y .")",
$arg1.';('.$arg2.');'.$arg3);

Can anyone help me with it? I'm not good in Regular Expresions so maybe
I can learn something from this group ;)


Why not just change the debug function not to work?

--
"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
http://outolempi.net/ahdistus/ - Satunnaisesti päivittyvä nettisarjis
sp**@outolempi.net || Gedoon-S @ IRCnet || rot13(xv***@bhgbyrzcv.arg)
KISS
Cut & Paste ???

Sep 7 '06 #3
<ro********@gazeta.plwrote in
news:11*********************@p79g2000cwp.googlegro ups.com...
Hi.
I writing a lot of code that contains calls to my own Debug functions
(like log).
I want to produce a release from my code without this function calls,
so I tried to write a program that reads a source code and removes this
function calls with preg_replace...
And here is a problem. I can't write a proper regexp for this use.

There are some call that contains more that one argument or arguments
are created dynamicaly, like:

log($myVar1, $myVar2. " -". $myVar3, "(x:". $x .", y:". $y .")",
$arg1.';('.$arg2.');'.$arg3);
Why you don't use some like this

<?php
global $DEBUG
$DEBUG = 1;
?>
.....
<?php
if($DEBUG) {
log($myVar1, $myVar2. " -". $myVar3, "(x:". $x .", y:". $y .")",
$arg1.';('.$arg2.');'.$arg3); }
?>

If you write code as I show you can disable your own debuging by change
$DEBUG to 0 at the begin of all scripts.
Or you can set $DEBUG value using some condition, for example
if($_ENV["SERVER_NAME"] == "Linux") {$DEBUG = 0;} else {$DEBUG = 1;}

--

Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your mail
from another non-spammer site please.)
Sep 7 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) {...
20
by: Steve Jorgensen | last post by:
A while back, I started boning up on Software Engineering best practices and learning about Agile programming. In the process, I've become much more committed to removing duplication in code at a...
5
by: pembed2003 | last post by:
Hi all, I need to write a function to search and replace part of a char* passed in to the function. I came up with the following: char* search_and_replace(char* source,char search,char*...
6
by: Vinay | last post by:
Hi Everybody I have been looking out for a Function call tree command in Unix environment. Given a piece of source code(millions of lines), there is a function F1() calling F2() calling F3()....
24
by: JB | last post by:
Hi All, This is doing my head in! Please help. I've built a simple <ul> to serve as a menu for a page I'm working on. I have tested the menu in Mozilla Fireworks 1.5 and it's fine - nice and...
3
by: Danny Yeadon | last post by:
Hi I need to remove unwanted characters from phone numbers from my phone bill to analyse the data. Some examples are 02 48222222 i need to remove the space +61266667656 ...
74
by: Zytan | last post by:
I have a struct constructor to initialize all of my private (or public readonly) fields. There still exists the default constructor that sets them all to zero. Is there a way to remove the...
3
by: Mark Poppers | last post by:
Assume the following sequence of user actions starting with a Form and an e.g. StatusStrip: 1.) User doubleclicks on the StatusStrip 2.) VisualStudio jumps to the new generated source code ...
61
by: arnuld | last post by:
I have created a program which creates and renames files. I have described everything in comments. All I have is the cod-duplication. function like fopen, sprint and fwrite are being called again...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.