forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Debug routine for VDS 3x...

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code
View previous topic :: View next topic  
Author Message
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Thu Mar 21, 2002 11:33 pm    Post subject: Debug routine for VDS 3x... Reply with quote

** VDS 3 and VDS 4 compatible **

Marty caught my interest with his debug routine
for VDS 4, and I thought I'd try a simpler command
line routine for VDS 3x that I could plug into most
any program. I think it's small enough to be left in
a finished app if you want.

IMPORTANT STUFF
- The routine should be placed immediately before the
event loop, as shown in this example. I also added a
small amount of code in the EVLOOP to catch and log
user events, but that's optional.
- If you want it to debug the window itself as it's being
created, you'll have to move the first IF/END routine
(not the whole debug routine) to the top of your code.
If you have a large complicated app, that's probably a
good idea.
- It uses LIST 9, so make sure that list is available.
- To use it as a command line option, use "debug" as
the first command line parameter.
- It writes a log file called [program name]_error.log.
If your prog is Test.exe, it writes to "Test_error.log".
- It gives you the option of continuing the program
or exiting immediately. The log file is saved anyway.
It opens the log file for viewing if you choose "no".
__________________________________________________________________________________________________________________________
Code:

rem -- Remove this if using "debug" at command line --
%1 = "debug"

OPTION SCALE, 96
OPTION DECIMALSEP, "."
TITLE By Mac
DIALOG CREATE,Debug Test Program,-1,0,215,40
  DIALOG ADD,BUTTON,Normal,10,5,100,20
  DIALOG ADD,BUTTON,Error,10,110,100,20
DIALOG SHOW

rem == Debugging procedure =================================
:DEBUG
  rem -- Move to top of code to debug window creation ------
  if @equal(%1, "debug")
     OPTION ERRORTRAP, ERROR
     LIST CREATE, 9
  end
  rem ------------------------------------------------------
  goto DEBUG_END
  :ERROR
    %%error = Error @error(E) at line @error(N)
    LIST ADD, 9, @datetime(hh:mm:ss am/pm) %%error
    LIST SAVEFILE, 9, @path(%0)@name(%0)_error.log
    if @not(@ask(%%error@cr()@cr()Do you wish to continue?@tab()))
       SHELL OPEN, @path(%0)@name(%0)_error.log
       STOP
    end
  :DEBUG_END
rem ========================================================

:EVLOOP
  WAIT EVENT
  %e = @event()
  if @equal(%1, "debug")
     LIST ADD, 9, @datetime(hh:mm:ss am/pm) %e event
  end
  goto %e

:NormalBUTTON
  INFO Hello world...@tab()
  goto EVLOOP

:ErrorBUTTON
  This line creates an error.
  goto EVLOOP

:CLOSE
  EXIT

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Fri Mar 22, 2002 12:32 am    Post subject: Reply with quote

OK, I think I have a better idea here...

IMPORTANT STUFF
- The complete debug procedure can now be located at
the top of the code where it will cover the whole program.
- Again, the event catching used in EVLOOP is optional.
- Your event loop must be named EVLOOP (or you can
change the "goto EVLOOP" line in the procedure to match
your routine).
- It warns you to choose NO if you don't see the main
program window. If the error is before DIALOG SHOW,
the program will continue running if you press YES, but
you can't see it. To avoid this problem for users, put the
procedure immediately after DIALOG SHOW.
__________________________________________________________________________________________________________________________
Code:

rem -- Remove this if using "debug" at command line --
%1 = "debug"

rem == Debugging procedure =================================
:DEBUG
  if @equal(%1, "debug")
     OPTION ERRORTRAP, ERROR
     LIST CREATE, 9
  end
  goto DEBUG_END
  :ERROR
    %%error = Error @error(E) at line @error(N)
    LIST ADD, 9, @datetime(hh:mm:ss am/pm) %%error
    LIST SAVEFILE, 9, @path(%0)@name(%0)_error.log
    if @not(@ask(%%error@cr()@cr()Do you wish to continue?@cr()@cr()Press NO if main program window is not visible.@tab()))
       SHELL OPEN, @path(%0)@name(%0)_error.log
       STOP
    end
    goto EVLOOP
  :DEBUG_END
rem ========================================================

OPTION SCALE, 96
OPTION DECIMALSEP, "."
TITLE By Mac
DIALOG CREATE,Debug Test Program,-1,0,215,40
  DIALOG ADD,BUTTON,Normal,10,5,100,20
  DIALOG ADD,BUTTON,Error,10,110,100,20
DIALOG SHOW

:EVLOOP
  WAIT EVENT
  %e = @event()
  if @equal(%1, "debug")
     LIST ADD, 9, @datetime(hh:mm:ss am/pm) %e event
  end
  goto %e

:NormalBUTTON
  INFO Hello world...@tab()
  goto EVLOOP

:ErrorBUTTON
  This line creates an error.
  goto EVLOOP

:CLOSE
  EXIT

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
marty
Professional Member
Professional Member


Joined: 10 May 2001
Posts: 789

PostPosted: Fri Mar 22, 2002 1:01 am    Post subject: Reply with quote

Ahhh!!! Mac! Like usual you did a great job!

I like your routine much better and its simplier... Wink

I guess my post should be updated...

Thanks Mac! Cool
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Fri Mar 22, 2002 1:54 am    Post subject: Reply with quote

No problem Marty. Wink

Thanks for the debuggin' inspiration... Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 3 Source Code All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group