#64825 - 2002-04-24 05:50 PM
Re: Debugging a UDF
|
Will Hetrick
Hey THIS is FUN
Registered: 2001-10-02
Posts: 320
Loc: Harrisburg, PA USA
|
OK, so take the follwing Code
code:
$value = "Compaq" $Where = "Manufacturer"
$RC = Checkini($value,$where) ? $RC
exit
Function CHECKINI($VALUE,$WHERE) $IniFile='$Server16 + "auditlog\Cinfo.INI"' ; $IniFile=substr('%WINDIR%',1,2)+'\Cinfo.INI' $INI = ReadProfileString($inifile,@wksta,"$where") Select Case (@ERROR <> 0) AND ($Value <> " ") WriteProfileString("$Inifile",@wksta,"$WHERE","$value") $CHECKini = $VALUE Case (@ERROR = 0) AND ($REG <= $VALUE) WriteProfileString("$Inifile",@wksta,"$WHERE","$value") $CHECKini = $VALUE Case (@ERROR = 0) AND ($REG > $VALUE) $CHECKini = $INI Case 1 $Checkini = $Value EndSelect Return EndFunction
When run in debug, Can you see which case it chooses?
_________________________
You have at least 2 choices. Each choice changes your destiny. Choose wisely!
|
Top
|
|
|
|
#64839 - 2002-04-25 04:00 PM
Re: Debugging a UDF
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear,
We aren't using very much the built-in debugging facility. Too much user input is necessary. Also it can be necessary to extend your script with additional code. We are using most of the time our debug option of kixstrip tool. You can easily see which lines were executed and what the kix- tart error status was.
Shawn's example:
code:
CLS COLOR C+/N AT (1,1) " " IF RedirectOutput("") ENDIF ? "-"+LCASE(@day)+" "+@date+" "+@time+"- kixtart "+@kix+"/3.04e script starting." ? "-" ? "-curdir: "+LCASE(@curdir) ? "-scriptdir: "+LCASE(@scriptdir) IF (instr("-4.1x-","-"+substr(@kix,1,3)+"x-") <> 0) ? "-scriptname: "+LCASE(@scriptname) ENDIF ? "-startdir: "+LCASE(@startdir) ? "-" ? "-userid: "+LCASE(@userid)+"/"+LCASE(@wuserid) ? "-user priv: "+LCASE(@priv) IF (instr("-4.xx-","-"+substr(@kix,1,2)+"xx-") <> 0) ? "-version: inwin="+@inwin+"/dos="+@dos"/productsuite="+@productsuite+"/producttype="+@producttype"/csd="+LTRIM(RTRIM(@csd)) ELSE ? "-version: inwin="+@inwin+"/dos="+@dos ENDIF ? "-" ?"- start-"+@time+"- @error @serror "?
?"- 1-"+@time+"- @error @serror "? BREAK ON ?"- 2-"+@time+"- @error @serror "? ?"- 3-"+@time+"- @error @serror "? $var = 2 ?"- 4-"+@time+"- @error @serror "? ?"- 5-"+@time+"- @error @serror "? $new = Echo($var) ?"- 6-"+@time+"- @error @serror "? ?"- 7-"+@time+"- @error @serror "? ?"newvar=" $new ?"- 8-"+@time+"- @error @serror "? ?"- 9-"+@time+"- @error @serror "? EXIT 1 ?"- 10-"+@time+"- @error @serror "? ?"- 11-"+@time+"- @error @serror "? FUNCTION Echo($var) ?"- 12-"+@time+"- @error @serror "? ?"- 13-"+@time+"- @error @serror "? SELECT ?"- 14-"+@time+"- @error @serror "? ?"- 15-"+@time+"- @error @serror "? CASE $var = 1 $echo = 1 ?"- 16-"+@time+"- @error @serror "? CASE $var = 2 $echo = 2 ?"- 17-"+@time+"- @error @serror "? CASE $var = 3 $echo = 3 ?"- 18-"+@time+"- @error @serror "? CASE 1 $echo = 0 ?"- 19-"+@time+"- @error @serror "? ?"- 20-"+@time+"- @error @serror "? ENDSELECT ?"- 21-"+@time+"- @error @serror "? ?"- 22-"+@time+"- @error @serror "? ENDFUNCTION ?"- 23-"+@time+"- @error @serror "?
?"- end-"+@time+"- @error @serror "? ? "-" ? "-"+LCASE(@day)+" "+@date+" "+@time+"- kixtart "+@kix+"/3.04e script ending." ? "-" IF (instr("-4.1x-","-"+substr(@kix,1,3)+"x-") <> 0) ? "-"+@cpu+" ("+@mhz+" Mhz, memory "+MemorySize()+" MB)" ENDIF ? "-" ;($begin) ; ; wed 24-apr-2002 23:54:17 (kix 4.10 vs 3.04e) ; ;Informative KIXSTRIP: no errors found (input=23 output=23 skip=0). ; ;Informative KIXSTRIP: 2 block_structures found. ;Informative KIXSTRIP: 1 UDF found. ;Informative KIXSTRIP: no labels found. ;Summary KIXSTRIP: BREAK CALL DEBUG DISPLAY ENDFUNCTION EXECUTE EXIT FUNCTION GET GETS GOSUB GOTO OLExxx PLAY QUIT RETURN RUN SHELL SLEEP THEN USE ;Informative KIXSTRIP: 1 BREAK ;Informative KIXSTRIP: 1 ENDFUNCTION ;Informative KIXSTRIP: 1 EXIT ;Informative KIXSTRIP: 1 FUNCTION ; ;($end)
The output will be:
code:
-wednesday 2002/04/24 23:54:57- kixtart 4.02/3.04e script starting. - -curdir: d:\ -scriptdir: -startdir: c:\windows - -userid: MCA/MCA -user priv: guest -version: inwin=2/dos=4.0/productsuite=/producttype=Windows 95/csd=B - - start-23:54:57- 0 The operation completed successfully.
- 1-23:54:57- 0 The operation completed successfully.
- 2-23:54:57- 0 The operation completed successfully.
- 3-23:54:57- 0 The operation completed successfully.
- 4-23:54:57- 0 The operation completed successfully.
- 5-23:54:57- 0 The operation completed successfully.
- 12-23:54:57- 0 The operation completed successfully.
- 13-23:54:57- 0 The operation completed successfully.
- 17-23:54:57- 0 The operation completed successfully.
- 21-23:54:57- 0 The operation completed successfully.
- 22-23:54:57- 0 The operation completed successfully.
- 6-23:54:57- 0 The operation completed successfully.
- 7-23:54:58- 0 The operation completed successfully.
newvar=2 - 8-23:54:58- 0 The operation completed successfully.
- 9-23:54:58- 0 The operation completed successfully.
greetings.
|
Top
|
|
|
|
#64840 - 2002-05-27 11:53 AM
Re: Debugging a UDF
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear,
Your question return the input about debugging only a part of it. We will implement a simple way of active and deactive "kixstrip debugging mode". greetings.
btw: related topics will be informed about upgrade, or you can get informed by your membership to our site. Select Mail - member of site tab from our main pages to become a member.
(TO_DO) [ 27 May 2002, 12:19: Message edited by: MCA ]
|
Top
|
|
|
|
#64841 - 2002-07-07 02:45 AM
Re: Debugging a UDF
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear,
We have upgrade our kixstrip tool. It recognizes new directives which makes it possible to debug only a selective part of your code. For the complete update info see topic http://81.17.37.55/board/ultimatebb.php?ubb=get_topic;f=2;t=001943 greetings.
|
Top
|
|
|
|
#64842 - 2002-07-16 01:34 PM
Re: Debugging a UDF
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 1574 anonymous users online.
|
|
|