Page 1 of 1

Unused functions in files or projects

Posted: Fri Aug 01, 2014 9:21 am
by Wolfgang Ciriack
Hi all,
inspired from the prog grok (Mark J. Carew, 2004) i decided to rewrite it for my needs. I removed the Database use and use an array for this, so the prog needed only 75 seconds instead of 1150 seconds for the same xpj-file. Inspired from some testers in the german forum and from my own needs i added a parameter check, a result viewer, Export to XLS, CSV, DBF and ARRAY, Import from saved ARR files and some things more.
Feel free to check and change it to your needs.
It can be configured for german and english.
Thanks to Roger for his great eXPress++ functions, so it was a lot easier to realize this. The xBaseTools libraries are needed, too.
Have fun.

Re: Unused functions in files or projects

Posted: Fri Aug 01, 2014 10:06 am
by rdonnay
Wolfgang -

This looks like good work.

I ran it against all the PRGs in \exp19\source\dclipx folder.

What does the Parameter - error column mean?

Roger

Re: Unused functions in files or projects

Posted: Fri Aug 01, 2014 11:04 am
by bwolfsohn
Wolfgang,

Looks interesting..

the only issue(s) i've found (so far) is it is falsely reporting myhandler is not being called from this construct in the same .prg

DCREAD GUI ;
HANDLER myhandler ;
OPTIONS GetOptions ;
FIT ;
TITLE "Real-Time Sale Viewing" ;

*****************
STATIC FUNCTION myHandler( nEvent, mp1, mp2, oXbp, oDlg, GetList )


and also falsely report popup_commchooser is not being called.
@ nRow, .5 DCPUSHBUTTON PARENT oCommissions;
CAPTION "Set Default ;Commission" FONT cFont ALIGNCAPTION BS_MULTILINE;
SIZE 10.5,2 OBJECT oDefaultCommissionButton ;
ACTION {||popup_commchooser(aLocals,aRates_,getlist,@cEditMode)} ;
WHEN {||cEditMode='V' .AND. !empty(LOCALCONSIGNOR_RATES)}

Re: Unused functions in files or projects

Posted: Fri Aug 01, 2014 1:55 pm
by hz_scotty
hello bwolfsohn,

have you a
function popup_commchooser(aLocals,aRates_,getlist,@cEditMode)
defined?
Where is it? in a source.prg or in a Library?

if it is in a program it will be found it count right
(tested by myself)

Re: Unused functions in files or projects

Posted: Fri Aug 01, 2014 2:10 pm
by Wolfgang Ciriack
Hi Roger,
thanks. In the error column are written the file names and the parameter check errors, f.e. defined is test(a,b,c) and i found test(a,b,,c) there is a parameter count fault 4<>3. I know, that the parameter check is not complete, the knowing hints are in the source.

Hi Brian,
i found all the HANDLER functions in my project as not used, too. I do not know if it is also possible to use HANDLER myhandler(). Roger ?
Perhaps i can handle this as an exception like the function calls in strings.

Here is an Update (without version change) because of a bug with loading the ini file.

Re: Unused functions in files or projects

Posted: Fri Aug 01, 2014 2:22 pm
by bwolfsohn
hz_scotty wrote:hello bwolfsohn,

have you a
function popup_commchooser(aLocals,aRates_,getlist,@cEditMode)
defined?
Where is it? in a source.prg or in a Library?

if it is in a program it will be found it count right
(tested by myself)
Wolfgang,

yes, it's in the same prg as the function which calls it.

static function popup_commchooser(aLocals,aAllRates_,aGetlist,cEditMode)

Re: Unused functions in files or projects

Posted: Fri Aug 01, 2014 2:33 pm
by Wolfgang Ciriack
Hi Brian,
i have copied

Code: Select all

@ nRow, .5 DCPUSHBUTTON PARENT oCommissions;
CAPTION "Set Default ;Commission" FONT cFont ALIGNCAPTION BS_MULTILINE;
SIZE 10.5,2 OBJECT oDefaultCommissionButton ;
ACTION {||popup_commchooser(aLocals,aRates_,getlist,@cEditMode)} ;
WHEN {||cEditMode='V' .AND. !empty(LOCALCONSIGNOR_RATES)}
and

Code: Select all

static function popup_commchooser(aLocals,aAllRates_,aGetlist,cEditMode)
return
in a file and tested it, it shows me 1 Hit which seems to be correct.

Re: Unused functions in files or projects

Posted: Fri Aug 01, 2014 2:48 pm
by bwolfsohn
wolfgang,

it's a rather large file, and it's getting lost in there somewhere... i found a number of these situations...

if you give me your email, i'll send the file directly to you for your testing..

just be aware, it's propietary code...

Re: Unused functions in files or projects

Posted: Fri Aug 01, 2014 11:04 pm
by Wolfgang Ciriack
you can send me the file to ciriack_at_ciju_dot_de.

Re: Unused functions in files or projects

Posted: Sun Aug 03, 2014 2:22 am
by Wolfgang Ciriack
Projekt-Checker Version 1.1.1, Changes:
- eXpress++ DCREADGUI... HANDLER func ... as exception for function in strings
- Parameter error changed in warning
- Added option 'Only parameter warning for more parameters as defined'
- Added Language selection, save settings (in INI file), commandline parameters for language removed
- Parameter scan corrected
- Definitions and hits of funktions over multiple lines (with ; continued lines) are considered
- Comment rows with "//" are considered from hits scanning.
- Added SQLExpressKey() und Xb2NetKey() as exceptions for functions