Page 1 of 1 1
Topic Options
#185239 - 2008-02-11 05:23 PM Kixtart script checking
duo Offline
Getting the hang of it

Registered: 2007-10-25
Posts: 61
Loc: iowa
Anyone know something that can test for warnings problems errors etc?
Top
#185241 - 2008-02-11 05:46 PM Re: Kixtart script checking [Re: duo]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Well yes and no.
Your question is quite general. What is your real problem?

Top
#185244 - 2008-02-11 07:01 PM Re: Kixtart script checking [Re: Witto]
duo Offline
Getting the hang of it

Registered: 2007-10-25
Posts: 61
Loc: iowa
http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=185185

But im asking for a general syntax checking device

Top
#185245 - 2008-02-11 07:10 PM Re: Kixtart script checking [Re: duo]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
A general syntax checking device?
An editor that has colour coding would do the trick to see if the kix syntax is correct.

http://www.adminscripteditor.com/ is the one I use and it works just fine.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#185246 - 2008-02-11 07:12 PM Re: Kixtart script checking [Re: duo]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
That's my Sanity UDF, as shown from KGen - another one of my tools that is used to sort-of link-edit your script with a library of function files.

KGen will scan your library, generate an association of what functions are in which files, and then scan your script file. It generates a resulting .KIX file with all necessary functions embedded, eliminating the need to manually include functions (and resolve their dependencies). As a final step, it generates several logs via Sanity(), including the output I showed you, and a reference of each variable, where it was declared, first referenced, etc. Excellent for debugging large or complex projects.

Sanity() is published here on on KORG, the latest revision is always on the resources page of my web site. The KixDev package on my site includes KGen, the entire dev library from the Resources page, and full documentation. You need to register your email to download, but the package is free. Email registration is kinda like collecting Ham radio call cards - I track who's using it, from where, and just demographic info, all of which helps me decide what products to focus on, and what improvements are warranted or suggested.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#185250 - 2008-02-11 08:05 PM Re: Kixtart script checking [Re: Glenn Barnas]
duo Offline
Getting the hang of it

Registered: 2007-10-25
Posts: 61
Loc: iowa
kgen seems like overkill/wrong for this
and im not in the market to buy ASE.
lets see what Sanity does for me

Top
#185253 - 2008-02-11 08:31 PM Re: Kixtart script checking [Re: duo]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
The Sanity UDF is an excellent script to locate potential errors in your script.

There is no tool that will be able to solve all your potential conflicts or missing code but Sanity will go a long way in clearing up common typos or general coding mistakes.

Using these SetOption values at the top of your script will also help / force you to write better code.

 Code:
$SO=SetOption('Explicit','On')
$SO=SetOption('NoVarsInStrings','On')
$SO=SetOption('NoMacrosInStrings','On')
$SO=SetOption('WrapAtEOL','On')

Top
#185254 - 2008-02-11 09:05 PM Re: Kixtart script checking [Re: NTDOC]
duo Offline
Getting the hang of it

Registered: 2007-10-25
Posts: 61
Loc: iowa
So what do you do when sanity gives you the clear and your error is random as heck?
Top
#185257 - 2008-02-11 09:25 PM Re: Kixtart script checking [Re: duo]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Kixtarter - KiXtart Script Editor?
Top
#185258 - 2008-02-11 09:26 PM Re: Kixtart script checking [Re: duo]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
What do you do when Sanity gives you the green light but some kind of error still comes up? Keep searching for the part where stuff goes wrong. This might take some time but that's just how it is. Nothing anybody can do about that.

Like said Sanity is not perfect but it does take you a long way (almost to the finish). If this is still about the script in the link you posted then there are some issues with your script.

First thing I see (besides the huge amount of blank lines) is this that there are several variables inside quotes, some even stuck together like this "$command2$command" or "$drive:". Second thins is the Functions. Why do you create all these functions and never call them? Third comment I have is the line where you run keyfinder.exe. There is a hidden share in the line that could give you some trouble. Using double $ sings would solve this but there is also a nice way around this with the NoVarsInStrings option.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#185260 - 2008-02-11 10:05 PM Re: Kixtart script checking [Re: Mart]
duo Offline
Getting the hang of it

Registered: 2007-10-25
Posts: 61
Loc: iowa
whats the difference between a blank line and a comment line?

ive never had any issues with the keyfinder line though im somewhat surprised about that

and what functions are sitting there not being used? every function is used multiple times, why else would i bother writing them?

Top
#185261 - 2008-02-11 10:20 PM Re: Kixtart script checking [Re: duo]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
[quote=duo]whats the difference between a blank line and a comment line?
....
 Quote:

A blank line is empty and a commented lines has something on it. Both will not cause any problems but it was just something I noticed.

[quote=duo]
....
ive never had any issues with the keyfinder line though im somewhat surprised about that
....
[/quoute]
The $ in the hidden share could be interpreted as a variable by kix so it could give you an error. They keyword here is could.

[quote=duo]
....
and what functions are sitting there not being used? every function is used multiple times, why else would i bother writing them?


Yes they are called/used. I've noticed that when reading though the entire script. Creating a script as a function is one way of doing things but not the best way in my in my book. In my opinion only the stuff that gets used several times in a script should be done as a function (like most of the stuff in the UDF library) so it can be called from anywhere in the script or even saved as a separate file to keep the script nice and clean. But that's just my opinion and we all know what opinions are like ;\)

I got the feeling you are getting a bit defensive but maybe it's just me taking it that way. No need for that cause it are only comments, suggestions and questions that come up when reading the script. If you don't like them then just don't use them. Everybody should write scripts as he or she wants and feels confident about.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#185263 - 2008-02-11 10:40 PM Re: Kixtart script checking [Re: Mart]
duo Offline
Getting the hang of it

Registered: 2007-10-25
Posts: 61
Loc: iowa
Agreed, right now the functions are separated from the actual script for good reason, i plan for it to be integrated in the future.
Top
#185264 - 2008-02-11 10:50 PM Re: Kixtart script checking [Re: Mart]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
Initially, KGen might seem like overkill, but - did you know that with KGen's kix and bat files in your path or in the current folder, along with Kix32.exe, you can write your code in a .TXT file and simply say "KGen myfile"? It will scan and run Sanity on your script - just that easily - resulting in a .KIX file on the spot? No installation or configuration - just a simple way to get Sanity results.

Of course, it will tell you it found no library functions, and included none as well.. ;\)

One of the coming features in KGen will be the ability to auto-generate the HTML/PostPrep file, and a report of commands that are supported by specific Kix versions - you'll be able to know if your script requires a specific mimimum version of Kix.

All you need to do to take the next step is put your function files on a server share somewhere and define KIXLIBPATH=\\server\share\folder, and KGen will automatically index and include any function from your library that you need. It generates the report files I showed you in the other thread, too. It can tokenize your script, but always leaves a plain-text .GEN file behind for you to recover from should you need it.

If you don't have a color-coding editor, you can check out the PostPrep script. A copy is available right from the first post in the Advanced Topics section. It will generate a colorized HTML file of your script, and you can even copy/paste the content into your posts (if you select HTML as your posting format option)

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#185265 - 2008-02-11 10:58 PM Re: Kixtart script checking [Re: duo]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4401
Loc: New Jersey
 Originally Posted By: duo
So what do you do when sanity gives you the clear and your error is random as heck?

Sanity will check common syntax, but not logic errors. For those, you're on your own. However...

The point of Sanity is more to foster good coding habits, simply because that in itself minimzes problems.

"Would you rather hunt for an elephant in a desert, where it has few places to hide, or in a forest?" Sanity will minimize the places that the bugs you're hunting can hide.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1188 anonymous users online.
Newest Members
StuTheCoder, M_Moore, BeeEm, min_seow, Audio
17884 Registered Users

Generated in 0.066 seconds in which 0.026 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org